I've started using sockets in programming with Java (I have experience with Python), and while testing a server that I'd written with the
telnet command, I noticed that the utility responds immediately to the server being killed. When I write a client with Java (or Python), it takes at the very least a few seconds for the program indicate that it has been disconnected. As far as I know, there isn't a way to test if a socket is connected, short of a heartbeat message, which my server was not written to accept or receive.
My question is, how to the folks at GNU know when my socket has been disconnected? Is there a part of TCP that I failed to find in my searching that would allow this? Thanks.