What happens to TCP packets between two Socket.BeginReceive calls?

I have doubts about socket programming. I am developing a TCP packet sniffer. I use Socket.BeginAccept, Socket.BeginReceive to capture each packet, but when the packet is received, I have to process something. This is a quick operation, but it will take a few milliseconds, and then call BeginReceive again.

My question is: what happens if some packets are sent during processing and do not call BeginReceive? Are packets lost or are they buffered internally? Is there a limit?

+3
source share
3 answers

Linux ​​ - , Windows . , deltreme, ( ), , .

- , threadpool . , . / - , . , , , .

+2

, , .

http://tangentsoft.net/wskfaq/ - , , winsock.

+1

TCP gives you a reliable stream, so data is not lost (assuming the core network is not crashing).

The OS at both ends has buffers that take care of bytes when you are not reading them. These buffers have a finite size, if they are full, TCP has flow control - essentially, the end of the send detects that the buffers are full and stop sending until more free space becomes available.

+1
source

Source: https://habr.com/ru/post/1740256/


All Articles