conn-tools
Software
www.skarnet.org
The timeoutcat program
timeoutcat copies its stdin to its stdout, until either it
receives a request to close or a certain amount of time elapses
without data being available.
Interface
timeoutcat timeout fdcontrol
- timeoutcat reads stdin and writes on stdout. It exits 0
when stdin closes, or 111 on a hard error.
- timeoutcat normally never exits as long as it has
unflushed data in its buffers.
- fdcontrol must be either 0 or a valid open file
descriptor.
- If timeout seconds elapse without data being available on
stdin, timeoutcat exits 99, or 111 if there is still unflushed
data in its buffers. A 0 value for timeout means infinite.
- If one of timeoutcat's ends is a socket, timeoutcat
shuts the relevant part down before exiting. This transmits a close request
to the other end of the socket, even when another process may still be
reading or writing the file. timeoutcat should be the only
process reading from a socket, or writing to it. Other processes will be
unable to use the socket once timeoutcat has died.
- If fdcontrol gets closed, and one of timeoutcat's
ends is a socket, timeoutcat shuts down the end it is
not using. The point of this is to allow a socket to be
properly handled by a set of two mutually-controlling timeoutcat
processes: if one of them dies unexpectedly, the other one will
shutdown() the relevant end of the socket.
A 0 value for fdcontrol means no such trigger.