How to detect lost telnet client connection