VIKAS MR wrote:
I had a TCP related question. I wrote a simple TCP based server (infinite loop) on Solaris 10 u5 which sleeps
for 1 sec before reading data. Then I wrote a simple client which which sends data continuously, I found that
after sending some data my client was getting blocked as it could not send more data. I used
"snoop" to discover that the server side TCP had sent "WIN=0". Then I exited the client
by using "CTRL +C".
Because your reader is slow (sleeping), hence the TCP receive window
is closed to stop the sender from sending more.
Question
We all know that if the client exits then it should trigger close and flush buffer's. But
the connection was still in "ESTABLISHED" state. And after few seconds the data
transmission continued even without the client program being alive. Why ?
So does it mean that even if my program exits the data will be sent ?
Since it is a graceful shutdown (ctrl-C kills the process and the
socket will be close()), TCP will keep on trying to send the
buffered data. So yes, even if your program exits, the buffered
data will still be sent. If you don't want this, you can enable
the SO_LINGER socket option with a 0 time. Then when the socket
is close(), it will do an abortive shutdown.
--
K. Poon.
[email protected]
_______________________________________________
networking-discuss mailing list
[email protected]