EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Why doesn't your socket detect that the remote side was disconnected?

TElSocket (or any other socket implementation) can't magically determine that the remote side has vanished or that the connection has been closed by the intermediate node (router, NAT, firewall etc). The socket can update its state after taking an explicit attempt to send something and analyzing  the result. In this case TCP stack tries to send a packet and after a certain timeout (or when the error is returned by lower-level protocol) reports an error to the upper level. Only this operation lets one reliably detect socket disconnection. This is how TCP sockets work in any OS and this is by design (remember that ARPANet was designed as a decentralized network which must survive the nuclear attack).

Many protocols include so-called keep-alive feature that usually includes sending an empty packet or no-operation command to the remote side in order to keep the socket alive and tell NATs and firewalls that they should not close the connection.

Return to the list


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!