tcpclient(1)

NAME
tcpclient - create an outgoing TCP connection

SYNOPSIS
tcpclient [ -46hHrRdDqQv ] [ -ilocalip ] [ -plocalport ] [ -Ttimeoutconn ] [ -llocalname ] [ -ttimeoutinfo ] [ -Iifname ] host port program [ arg ... ]

DESCRIPTION
tcpclient attempts to connect to a TCP server. If it is successful, it runs program with the given arguments, with descriptor 6 reading from the network and descriptor 7 writing to the network. The server's address is given by host and port. host may be 0, which is identical to 127.0.0.1, or ::1 referring to the IPv6 loopback address, a compactified IPv6 address, a dotted-decimal IPv4 address, or a host name. If a host name is given, tcpclient facilitates a DNS lookup and tries each address in turn. port may be a numeric port number or a port name. tcpclient sets up several environment variables, as described in tcp-environ(5).

OPTIONS

-4  Force IPv4 connections

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

-ilocalip
    Use localip as the IP address for the local side of the connection; quit if localip is not available.

-plocalport
    Use localport as the port number for the local side of the connection; quit if localport is not available.

-Iifname
    Use ifname as the local network interface. This is only defined for IPv6 sockets and needed if you use link-local IPv6 addresses.

-Ttimeoutconn
    Give up on the connection attempt after timeoutconn seconds. Default: 60. This timeout applies to each IP address tried.

-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

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

-H  Do not look up the remote host name; unset TCPREMOTEHOST.

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

-r  (Default.) Attempt to obtain TCPREMOTEINFO from the remote host.

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

-ttimeoutinfo
    Give up on the TCPREMOTEINFO connection attempt after timeoutinfo seconds. Default: 26.

ENVIRONMENT VARIABLES READ
tcpclient reads the environment variable DNSCACHEIP which can be used to specify the recursive DNS Resolver dynamically.

ENVIRONMENT VARIABLE SET
tcplient will set: PROTO to TCP or TCP6. TCPLOCALIP and TCP6LOCALIP together with TCPLOCALPORT and TCP6LOCALPORT. Also TCPREMOTEIP and TCP6REMOTEIP is together provided with TCPREMOTEPORT and TCP6REMOTEPORT. Finally, TCPREMOTEHOST and TCPREMOTEINFO is given.

SEE ALSO
date@(1), finger@(1), http@(1), mconnect(1), tcpcat(1), tcpserver(1), who@(1), tcp-environ(5)