This content has been marked as final. Show 6 replies
Thanks a lot for your reply.
EJP wrote:I don't have in depth knowledge regarding how TCP works. So what I'm not clear about the above is what is the different between one side closing the application and being unreachable due to network issue? is there any message sent to the counter party when the process which created and using the the socket abruptly shuts down at one end.
That's how TCP works.
TCP 'allows' you to unplug the network (*) and plug it back in after a cigarette
and if neither end attempted to transmit data while the network was unplugged
the TCP socket still exists.
(*) assuming the TCP stack does not detect and react to media disconnect.
user13752858 wrote:When a TCP socket is closed
... what is the different difference between one side closing the application and being unreachable due to network issue?
FIN is sent or possibly RST if there is data in the TCP buffers.
is there any message sent to the counter party when the process which created and using the the socket abruptly shuts down at one end.If a process terminates without closing TCP sockets
the TCP stack probably tidies up each TCP socket and
sends RST to the remote or possibly FIN if there is no data in the TCP buffers.
user13752858 wrote:Media disconnect detection is typically something done in the Network Interface Card driver.
what are the situations TCP stack detects and cant detect the media disconnect?
If you have two or more routers / switches / hubs between the two boxes
and you disconnect the network somewhere not directly connected to your NIC it will not be able to detect it.
TCP will reconnect/resend/workaround most problems which can be fixed programmatic-ally. If you are seeing an error, it will be a serious one which there is not much you can do about other than to retry and perhaps notify a human.
You get different return values/exception however there is not much you can do about it except notify a human to fix it.
All the program can do is to decided whether and how to try again.
E.g. say the network is disconnected somewhere, there is no Java command which will reconnect or fix that wire.