.TH tcpclient 1 .SH NAME tcpclient \- creates an outgoing TCP connection. .SH SYNOPSIS .B tcpclient [ .I opts ] .I host .I port .I prog .SH DESCRIPTION .I opts is a series of getopt-style options. .I host is one argument. .I port is one argument. .I prog consists of one or more arguments. .B tcpclient attempts to connect to a TCP server. If it is successful, it runs .IR prog , with descriptor 6 reading from the network and descriptor 7 writing to the network. It also sets up several environment variables (see .BR tcp-environ (5) ). The server's address is given by .I host and .IR port . .I port may be a name from /etc/services or a number. .I host may be 0, referring to the local machine, or a dotted-decimal IP address, or a host name; it is fed through qualification using dns_ip4_qualify. If the server has several IP addresses, .B tcpclient tries each address in turn. .SH OPTIONS .B General options: .TP .B \-q Quiet. Do not print error messages. .TP .B \-Q (Default.) Print error messages. .TP .B \-v Verbose. Print error messages and status messages. .P .B Connection options: .TP .B \-T \fIx\fR+\fIy Give up on the connection attempt after .I x\fR+\fIy seconds. Default: 2+58. When a host has several IP addresses, .B tcpclient tries to connect to the first IP address, waits .I x seconds, tries to connect to the second IP address, waits .I x seconds, etc.; then it retries each address that timed out, waiting .I y seconds per address. You may omit .RI + y to skip the second try. Before version 0.88, .BR tcpclient (1) will use only .I x (default: 60). .TP .B \-i \fIlocalip Use .I localip as the IP address for the local side of the connection; quit if .I localip is not available. Normally .B tcpclient lets the operating system choose an address. .TP .B \-p \fIlocalport Use .I localport as the TCP port for the local side of the connection; quit if .I localport is not available. Normally .B tcpclient lets the operating system choose a port. .TP .B \-d Delay sending data for a fraction of a second whenever the remote host is responding slowly. This is currently the default, but it may not be in the future; if you want it, set it explicitly. .TP .B \-D Never delay sending data; enable TCP_NODELAY. .P .B Data-gathering options: .TP .B \-h (Default.) Look up the remote host name in DNS to set the environment variable $TCPREMOTEHOST. .TP .B \-H Do not look up the remote host name in DNS; remove the environment variable $TCPREMOTEHOST. .TP .B \-l \fIlocalname Do not look up the local host name in DNS; use .I localname for the environment variable $TCPLOCALHOST. A common choice for localname is 0. .TP .B \-r (Default.) Attempt to obtain $TCPREMOTEINFO from the remote host. .TP .B \-R Do not attempt to obtain $TCPREMOTEINFO from the remote host. .TP .B \-t \fIn Give up on the $TCPREMOTEINFO connection attempt after .I n seconds. Default: 26. .SH SEE ALSO tcpserver(1), tcprules(1), tcprulescheck(1), argv0(1), fixcrio(1), recordio(1), rblsmtpd(1), who@(1), date@(1), finger@(1), http@(1), tcpcat(1), mconnect(1), tcp-environ(5) http://cr.yp.to/ucspi-tcp.html