Try searching the forum for threads related to "fileevent", as this is the mechanism you'll end up using for events. A very rough example however: proc isReadable {socket} { if {[gets $socket line] < 0} { if {[eof $socket]} { close $socket #Cleanup code: Connection closed by remote host i...