Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. TCP question

TCP question

Scheduled Pinned Locked Moved C / C++ / MFC
questionjson
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BambooMoon
    wrote on last edited by
    #1

    If I have two processes connected via TCP (blocking), if one process writes data to the socket and then closes its end of the socket connection without any kind of handshake from the other process, will the other process still be able to read the data sent by the first process? Or will the data be thrown away when the first process closes the socket (in other words, is a handshake required)? In my situation, process A sends a large amount of data (perhaps a megabyte) and then needs to close to service other requests. Process B will always have a blocking read on the socket at the time that process A sends, but the read is specifically for a smaller number of bytes than the total number that process A sent. Process B has to read the header of the data to determine how long the rest of the message is, but by the time process B figures this out and posts another read, presumably process A will have closed its end of the socket. It appears to me that process B is always getting all the data, but I cannot find any documentation that says that this is the expected behavior. I don't want it just to be a coincidence.

    L 1 Reply Last reply
    0
    • B BambooMoon

      If I have two processes connected via TCP (blocking), if one process writes data to the socket and then closes its end of the socket connection without any kind of handshake from the other process, will the other process still be able to read the data sent by the first process? Or will the data be thrown away when the first process closes the socket (in other words, is a handshake required)? In my situation, process A sends a large amount of data (perhaps a megabyte) and then needs to close to service other requests. Process B will always have a blocking read on the socket at the time that process A sends, but the read is specifically for a smaller number of bytes than the total number that process A sent. Process B has to read the header of the data to determine how long the rest of the message is, but by the time process B figures this out and posts another read, presumably process A will have closed its end of the socket. It appears to me that process B is always getting all the data, but I cannot find any documentation that says that this is the expected behavior. I don't want it just to be a coincidence.

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      http://www.freesoft.org/CIE/RFC/1122/99.htm[^] 4.2.2.13 Closing a Connection: RFC-793 Section 3.5 "The normal TCP close sequence delivers buffered data reliably in both directions."

      "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
      Colin Angus Mackay in the C# forum

      led mike

      B 1 Reply Last reply
      0
      • L led mike

        http://www.freesoft.org/CIE/RFC/1122/99.htm[^] 4.2.2.13 Closing a Connection: RFC-793 Section 3.5 "The normal TCP close sequence delivers buffered data reliably in both directions."

        "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
        Colin Angus Mackay in the C# forum

        led mike

        B Offline
        B Offline
        BambooMoon
        wrote on last edited by
        #3

        You are the best. Thanks.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups