tcpserver - accept incoming TCP connections
tcpserver [ -146jpPhHrRoOdDqQv ] [ -climit ] [ -X-xrules.cdb ] [
-Bbanner ] [ -ggid ] [ -uuid ] [ -bbacklog ] [ -llocalname ] [
-ttimeout ] [ -Iifname ] host port program [ arg ... ]
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.
tcpserver will attach to the primary IP address of host while the host
name is fed through qualification using dns_ip6_qualify. If host is
given as dotted decimal IPv4 or compactified IPv6 address, tcpserver
will bind uniquely to those. In order to bind tcpserver to a LLU IPv6
address (ie. fe80::a:b:c) additionally the interface name -Iifname has
to be provided.
Note: The kernel might use temporary changing SLAAC addresses.
tcpserver can be instructed to be multi-homing capable while binding to
all available IP addresses. Now host is given as '0' or '::' perhaps
accompanied by the flags -4 or -6.
Further, tcpserver may be forced to provide dual-stack capabilities,
thus allowing IPv4 and IPv6 clients to attach to the same instance once
host equals ':0' as pseudo IP address.
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
tcpserver exits when it receives SIGTERM.
-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.
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.
This feature can be used to reduce latency in protocols where
the client waits for a greeting from the server.
-ggid Switch group ID to gid after preparing to receive connections.
gid must be a positive integer.
-uuid Switch user ID to uid after preparing to receive connections.
uid must be a positive integer.
Bind to the network interface ifname ("eth0" on Linux, for
example). This is only defined and needed for IPv6 link-local
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.
-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.
this is the host-scoped loopback-address, while
is the link-scoped looback-address and lo0 is the name of the loopback
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,
In case of a successfull IDENT lookup: TCPREMOTEINFO.
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.
argv0(1), fixcr(1), recordio(1), tcpclient(1), tcprules(1), listen(2),
Man(1) output converted with