What happens when a buffer overflows?

I read somewhere that each TCP connection has its own 125kB output and input buffer. What happens if this buffer is full and I keep sending data to Linux?

According to http://www.kernel.org/doc/man-pages/online/pages/man2/send.2.html , packages are simply silently deleted without notifying me. What can I do to prevent this from happening? Is there a way to find out if at least some of my data is sent correctly so that I can continue at a later moment?

+2
source share
2 answers

The short answer is this. β€œsend” calls to the TCP socket will only be blocked until the TCP pivot window (or internal queue buffers) opens as a result of the remote endpoint receiving and consuming data. This is not much different from trying to write bytes to a file faster than the disk can save it.

If your socket is configured for non-blocking mode, sending will return EWOULDBLOCK or EAGAIN until data is sent. The standard poll , select and epoll will work as expected, so you know when to send again.

+6
source

I do not know what "packets are discarded." I think it is more likely that the calls that the program makes to write () either block or return a failure.

0
source

All Articles