Socket: Detect connection close

Casper Færgemand" <shorttail at hotmail.com> Casper Færgemand" <shorttail at hotmail.com>
Sun Mar 23 20:12:23 PDT 2014


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.


More information about the Digitalmars-d-learn mailing list