D. J. Bernstein

The tcpserver program

tcpserver accepts incoming TCP connections.


     tcpserver opts host port prog
opts is a series of getopt-style options. host is one argument. port is one argument. prog consists of one or more arguments.

tcpserver waits for connections from TCP clients. For each connection, it runs prog, with descriptor 0 reading from the network and descriptor 1 writing to the network. It also sets up several environment variables.

The server's address is given by host and port. port may be a name from /etc/services or a number; if it is 0, tcpserver will choose a free TCP port. host may be 0, allowing connections to any local IP address; or a dotted-decimal IP address, allowing connections only to that address; or a host name, allowing connections to the first IP address for that host. Host names are fed through qualification using dns_ip4_qualify.

tcpserver exits when it receives SIGTERM.


General options: Connection options: Data-gathering options: