SOCKETs: recv after accept
-
Hi, first of all, sorry for posting on the VC++ board, but there is no networking board here, and due to the fact that I am using VC++ ... here I go: I got a question on SOCKETs. I have a SOCKET listening on a specified port. When a client connects, I call accept. Due to specific reasons I do not call recv after this directly. There are about 1-2 seconds after the accept call until I loop on recv. Now my question: what happens with the data sent from the client to my SOCKET in the meanwhile? Is it lost? Is is buffered and I receive it when I then call recv? Thanks a lot! Chris
-
Hi, first of all, sorry for posting on the VC++ board, but there is no networking board here, and due to the fact that I am using VC++ ... here I go: I got a question on SOCKETs. I have a SOCKET listening on a specified port. When a client connects, I call accept. Due to specific reasons I do not call recv after this directly. There are about 1-2 seconds after the accept call until I loop on recv. Now my question: what happens with the data sent from the client to my SOCKET in the meanwhile? Is it lost? Is is buffered and I receive it when I then call recv? Thanks a lot! Chris
If it's TCP, you needn't worry. It's buffered, and if the buffer space runs out the other side will know this. If it's UDP -- it will get buffered on your side until the buffer runs out. Then new packets will get lost. If it's another protocol -- well, that's up to your protocol stack. -- Nitzan
-
Hi, first of all, sorry for posting on the VC++ board, but there is no networking board here, and due to the fact that I am using VC++ ... here I go: I got a question on SOCKETs. I have a SOCKET listening on a specified port. When a client connects, I call accept. Due to specific reasons I do not call recv after this directly. There are about 1-2 seconds after the accept call until I loop on recv. Now my question: what happens with the data sent from the client to my SOCKET in the meanwhile? Is it lost? Is is buffered and I receive it when I then call recv? Thanks a lot! Chris
-
If it's TCP, you needn't worry. It's buffered, and if the buffer space runs out the other side will know this. If it's UDP -- it will get buffered on your side until the buffer runs out. Then new packets will get lost. If it's another protocol -- well, that's up to your protocol stack. -- Nitzan
Thanks Nitzan! I am using TCP and this is also what I thought. Chris