In Java, the only way to know is to attempt to send something. I presume it's limited that way because the OS's don't provide more info, or because TCP itself does not tell if a connection has closed unless something is sent.

I could be wrong, but all my network code in other languages rely on sending stuff to register a closed connection. For connections that are open for a very long time with low throughput I send small packages regularly just to be sure it's still open.

Reply via email to