Once you have successfully written data to the socket, it is in the kernel buffer, where it will remain until it is sent and acknowledged. Shutting down does not result in loss of buffered data. Closing a socket does not cause buffered data to be lost. Even the death of the sending process will not cause fading data to fade.
You can observe the buffer size with netstat . The SendQ column is the amount of data that the kernel still wants to transmit.
After the client confirmed everything, the port disappeared from the server. This can happen before the client reads the data, in which case it will be in RecvQ on the client. Basically, you have nothing to worry about. After successfully writing to the TCP socket, each component tries its best to ensure that your data hits the target unscathed, regardless of what happens to the sending socket and / or process.
Well, maybe one thing to worry about: if a client tries to send something after the server shuts down, it can get SIGPIPE and die before it reads all available data from the socket.
source share