NAME

         tcpsocket - create a TCP socket and run a program


SYNOPSIS

tcpsocket [options] host port program [arguments]


DESCRIPTION

tcpserver creates a TCP socket, binds it to host and port and runs program with the remaining arguments.

options is a is a series of getopt or getopt_long style options. See below for more information.

The socket is described by host and port. host may be 0, allowing connections to any local IP address; or a dotted-decimal IP 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_IP4_qualify. port may be a name from /etc/services or a number; if it is 0, tcpsocket will choose a free TCP port.


OPTIONS Some people make this separate from the description.

Socket options:

-b, --backlog=N
Allow a backlog of N TCP SYNs.

On some systems, N is silently limited to 5. On systems supporting SYN cookies, the backlog is irrelevant. The default is 20.

-d, --tcpdelay
Delay sending data for a fraction of a second whenever the remote host is responding slowly. This is the default, but it may not be in the future; if you want it, set it explicitly.

-D, --tcpnodelay
Never delay sending data; enable TCP_NODELAY.

-o, --allow-ip-options
Leave IP options alone.

If the client is sending packets along an IP source route, send packets back along the same route.

-O, --kill-ip-options
Kill IP options.

A client can still use source routing to connect and to send data, but packets will be sent back along the default route. This is the default.

Child program options:

-C, --chroot=DIR
Change the working directory to DIR. Then change the root directory of the process to . (the current directory). This will be done after the socket has been created and before changing the group or user ID.

-F, --fd=N
Move socket handle to file descriptor N.

N is an integer in the range from 0 to a system ``dependent limit. The default is to not move it. Note that moving the socket to file descriptor 2 may disturb the output of error messages.

-g, --gid=GID
Group ID to change to.

tcpsocket will switch to that group id after the socket has been set up. GID has to be a positive integer.

-u, --uid=UID
User ID to change to.

tcpsocket will switch to that user id after the socket has been set up. UID has to be a positive integer.

-U, --uidgid
The same as -u $UID -g $GID.

Usually used together with envuidgid.

Data-gathering options:

-l, --localhost=NAME
Use NAME as local host name.

Do not look up the local host name in the DNS. This information is used for log files and the environment variable IODP_n_LOCALNAME

-y, --symbolic-name=NAME
Use NAME as symbolic socket name.

This is used for $IODP_n_SYMNAME, and may be used by IODP compliant application in an application dependant way. The default is to not set it.

Verbosity options:

-1
Print the local port number to the standard output.

-q, --quiet
Quiet. Do not print error messages.

-Q
Print error messages.

This is the default.

-v, --verbose
Verbose. Print error and status messages.

--version
Show version information.

--help
Show a list of options or the long help on one.

The use with an argument shows the long helptext of that option, without an argument it will list all options.

--longhelp
Show longer help texts for all or one variable

The use with an argument shows the long help for this option, without arguments it shows the long description of all options.


ENVIRONMENT

tcpsocket sets the environment variables documented in the iodp-tcp specification.


EXAMPLES

        tcpsocket 0 119 \
        setuidgid news \
        env - PATH="$PATH:/news/bin" TMPDIR=/news/tmp SHELL=/bin/sh \
            LOGNAME=news USER=news HOME=/news  \
        /news/bin/innd


BUGS

unknown.


AUTHOR

Uwe Ohse


SEE ALSO

Uwe Ohse homepage

IODP tools