conn-tools
Software
www.skarnet.org

The timeoutafter program

timeoutafter watches a connection and closes it after a certain amount of inactivity.

Interface

     timeoutafter secs prog [ args ... ]
timeoutafter execs prog (the "server"), without changing PIDs. If secs seconds elapse without data being available on the "server" side (i.e. without prog writing to stdout), the connection is closed.

Internals

timeoutafter forks a child ioconnect process before executing prog. ioconnect must be in the program's PATH.

Be warned that the ioconnect process could interfere with prog's SIGCHILD handling, if any. A well-designed prog will always check the PIDs of the children it spawns and waits for, though, so it should not be a problem in most cases.

Examples of use