CodePudding user response:
May be lost package, to check whether send buffer is full, if full stop to write data, or you will lost package,CodePudding user response:
Don't need you to do anything,TCP protocol itself has a complete mechanism to ensure data transceiver, this we don't explain yourself baidu "TCP moving window
"
In fact, a lot of people just starting this must solve a problem, that is, the hair not hair, nor accept
Because between you and sending cache, receiving cache, and the underlying protocol, the underlying communication guarantee,
So you said you closed, but it is not you, but the underlying charge, you just took from the buffer and buffer to tell the other party can send a physical package under the moving window
But you said not to hold, it's not you don't stop, you are in the buffer, the underlying this according to the agreement to determine whether need to send a physical package under the moving window, if the other party slowly, moving window is moving slowly, if they don't accept, the buffer is full or send timeout, you will get an exception
So you don't need to do, you need to do is just waiting for the exception, without exception, that's just the network is slow, slow, you can do
CodePudding user response: