But how come here you said that this is a JavaBut who said that?
problem that write() on a broken socket will not
given you the Java exceptoin?
1. read() on a broken socket will return you a -1 /Only if the connection got an orderly close from the other end, or it was reset at the other end for some reason and you have subsequently written some data. Not to be relied on.
null / IOException
2. write() on a broken socket will return you aEventually, after some buffers have been flushed. You can't rely on the first write to a broken connection doing it but you can rely on it happening eventually, and after not many extra writes.
And ppl also mentions it would be different if theYes, see above. If you read from a properly closed connection you get -1/null/EOF. If you write to it you get the same exception as above.
server has closed the socket normally... eg.
socket.close() or someone just unpluged the server or
network, each will have a different behaviour to the
SO SO confused.
Please Please help. So what would be the best way toWrite to it.
dectect broken socket to the server?