SYNOPSIS

       tcpserver [ -146jpPhHrRoOdDqQv ] [ -climit ] [ -X-xrules.cdb ] [
       -Bbanner ] [ -ggid ] [ -uuid ] [ -bbacklog ] [ -llocalname ] [
       -ttimeout ] [ -Iifname ] host port program [ arg ...  ]


DESCRIPTION

       tcpserver waits for connections from TCP clients.  For each connection,
       it runs program with the given arguments, with descriptor 0 reading
       from the network and descriptor 1 writing to the network.

       The server's address is given by host and port.  host may be 0, or a
       dotted-decimal IPv4 or a compactified IPv6 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_ip6_qualify.  port may be a numeric port number
       or a port name.  If port is 0, tcpserver will choose a free port.

       tcpserver sets up several environment variables, as described in
       tcp-environ(5).

       tcpserver exits when it receives SIGTERM.


OPTIONS

       -1     After preparing to receive connections, print the local ip
              address and port number to standard output.

       -4     Use IPv4 sockets.

       -6     Force IPv6 mode. This will set PROTO to TCP6 and put IPv4-mapped
              IPv6 addresses in TCPLOCALIP and TCPREMOTEIP.

       -climit
              Do not handle more than limit simultaneous connections.  If
              there are limit simultaneous copies of program running, defer
              acceptance of a new connection until one copy finishes.  limit
              must be a positive integer.  Default: 40.

       -xrules.cdb
              Follow the rules compiled into rules.cdb by tcprules.  These
              rules may specify setting environment variables or rejecting
              connections from bad sources.

              tcpserver does not read rules.cdb into memory; you can rerun
              tcprules to change tcpserver's behavior on the fly.

       -X     continue processing, even if rules.cdb is not readable.

       -Bbanner
              Write banner to the network immediately after each connection is
              made.  tcpserver writes banner before looking up TCPREMOTEHOST,
              before looking up TCPREMOTEINFO, and before checking rules.cdb.

       -bbacklog
              Allow up to backlog simultaneous SYN_RECEIVEDs.  Default: 20.
              On some systems, backlog is silently limited to 5.  See
              listen(2) for more details.

       -o     Leave IP options alone.  If the client is sending packets along
              an IP source route, send packets back along the same route.

       -O     (Default.)  Kill IP options.  A client can still use IPv4/IPv6
              source routing to connect and to send data, but packets will be
              sent back along the default route.

       -d     (Default.)  Delay sending data for a fraction of a second
              whenever the remote host is responding slowly, to make better
              use of the network.

       -D     Never delay sending data; enable TCP_NODELAY.  This is
              appropriate for interactive connections.

       -q     Quiet.  Do not print any messages.

       -Q     (Default.)  Print error messages.

       -v     Verbose.  Print all available messages.


DATA-GATHERING OPTIONS

       -p     Paranoid.  After looking up the remote host name, look up the IP
              addresses for that name, and make sure one of them matches
              TCPREMOTEIP.  If none of them do, unset TCPREMOTEHOST.

       -P     (Default.)  Not paranoid.

       -h     (Default.)  Look up the remote host name and set TCPREMOTEHOST.

       -H     Do not look up the remote host name.

       -llocalname
              Do not look up the local host name; use localname for
              TCPLOCALHOST.

       -r     Attempt to obtain TCPREMOTEINFO from the remote host.

       -R     (Default.)  Do not attempt to obtain TCPREMOTEINFO from the
              remote host.

       -ttimeout
              Give up on the TCPREMOTEINFO connection attempt after timeout
              seconds. Default: 26.


BINDINGS

       tcpserver will bind automatically to any available IP addresses at
       start-up time, in case 0 is specified or as host.
       this is the host-scoped loopback-address, while

              fe80::1%lo0

       is the link-scoped looback-address and lo0 is the name of the loopback
       interface.


DNS RESOLVER SETTINGS

       Use $DNSCACHEIP to set the DNS resolver's IP(s) dynamically
       irrespectively from the settings in /etc/resolv.conf.  The individual
       IPs are separated by blanks; IPv6 LLU addresses may be appended with
       the interface name following a '%' sign.  If the environment variable
       $LOCALDOMAIN is populated, this name will be appended to unqualified
       host names.  Additional rewriting of local to public names is
       facilitated in case the file /etc/dnsrewritefile exists and is
       populated, or alternatively, the environment variable $DNSREWRITEFILE
       points to a different file.


ENVIRONMENT VARIABLES SET

       tcpserver provides the following environment variables:

       PROTO this is either TCP or TCP6.

       The interface name for IPv6 connections: TCP6INTERFACE.

       The local information: TCPLOCALIP, TCP6LOCLAIP, TCPLOCALPORT,
       TCP6LOCALPORT, TCPLOCALHOST, TCP6LOCALHOST.

       The IP address of connection: TCPREMOTEIP and TCP6REMOTEIP.

       The remote port number: TCPREMOTEPORT, TCP6REMOTEPORT.

       The hostname (FQDN) of the peer, if available: TCPREMOTEHOST,
       TCP6REMOTEHOST.

       In case of a successfull IDENT lookup: TCPREMOTEINFO.


LOGGING

       Invoking tcpserver with the option -v will provide a logging of the
       session including local and remote IP addresses and port.  In case the
       option -h is given, the remote hostname is displayed, if available.


SEE ALSO

       argv0(1), fixcr(1), recordio(1), tcpclient(1), tcprules(1), listen(2),
       tcp-environ(5)



                                                                  tcpserver(1)

Man(1) output converted with man2html