I have a thread that writes to a TCP socket every 5 sec., connected to a remote TCP port (using Java .net socket, not NIO). For your information I have not configured any timeout (S0,..) on to the socket layer, it’s having the default values. If the network cable connected to remote TCP port
is removed my java thread is not getting any IO exception, rather it keeps writing to the socket.
Can somebody guide me why am I not getting those exceptions? I guess write method should through IOException while trying to write to the socket every 5 sec.
Regards, Rajib
This depends entirely an how much you write to the socket, in case you don’t flush regurarly. If you write only a couple of bytes every 5 seconds, it may indeed take quite a bit for the buffer to fill and flush automatically. The exception should arise eventually. If you do flush, then there could be another network pipe that you are overlooking, such as WiFi, and the transport just fails over to that one.