Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-17425

recv() on closed connections with MSG_PEEK causes future ECONNRESET

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • None
    • None

    Description

      When calling recv() with MSG_PEEK set it will give you the number of bytes you can read. When you run recv() again, it should return the same number I think? At least it does on Linux, Wine, and Windows 10 (20H2.)

      I wrote a test program (attached as exe and C code) that compiles with MinGW. It will download the http://reactos.org/ web page over TCP, peeking at each packet before actually recv()ing it.

      On the final recv() on all the systems I've tested it should peek and read both 0 bytes and say 'detected connection close, GOOD'.

      On ReactOS 0.4.13 it peeks 0 but reads -1 with an error of 10054 and complains about that.

       

      POSIX and Windows indicate that a return value of 0 indicates the peer has done an orderly shutdown. It's kind of strange to get a value of 0 then WSAECONNRESET indicated the remote side executed a hard or abortive close.

      Attachments

        1. DEBUG.LOG
          75 kB
        2. recv_tester.c
          2 kB
        3. recv_tester.exe
          213 kB

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Jookia Jookia
              Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: