Consulting djbware Publications

tcpclient - setup an outgoing IPv4/IPv6 TCP connection for application

Purpose

tcpclient enables an application to connect via TCP to a remote server.

Application support

Applications are enabled by means of tcpclient to communication bi-directional over the IP network via the standard file descriptors

  1. FD 6: Reading from the network.
  2. FD 7: Writing to the network.

The Application may be supplied with any arguments on call.

Remote host

Typically the remote host is simply given as

together with the remote connection port:

In case host is provided as DNS name, you can tell tcpclient to use

and eventually providing

for IPv6 connections using LLU addresses.

tcpclient is enabled to do an IDENT/TAP lookup at the server prior of establishing the connection; but this is not recommended any more:

Local binding

tcpclient usually uses the host's primary IP address, but can otherwise bind to any IPv4 and/or IPv6 address of the system and may use a certain port (otherwise it choses a free one):

Name resolution

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

If not given, tcpclient uses the nameserver entries provided in /etc/resolv.conf.