The TCPSRUN command listens for and accepts incoming TCP connections at the given address and port. For each accepted connection, it spawns a command to deal with it.
TCPSRUN is a replacement for INETD. Because it handles one port rather than many, it allows for fine grained control of individual TCP services. It also provides greater flexibility in what programs are run and how they are invoked.
address is the IP address, in decimal notation, on which TCPSRUN listens. To have TCPSRUN listen on all IP addresses on all interfaces on the machine, use the IP address 0.0.0.0 .
port is the port on which TCPSRUN listens. This may either be
a number or the name of a TCP service which is looked up in the
runfile is a run file that TCPSRUN parses to determine what program to run, and with what arguments and environment, to handle the connection. The process inherits the same set of standard file I/O handles that TCPSRUN itself inherits. TCPSRUN does not wait for the program to complete, or check its exit code. It parses the contents of the run file anew for every connection, allowing the run file to be modified without having to restart TCPSRUN.
TCPSRUN defines the following replacement parameters in run files:
TCPSRUN expects the spawned program to assume responsibility for the socket representing the accepted TCP connection. The convention for programs spawned from INETD is that the socket number is passed to the program as its first non-option argument. This can be expressed in a run file using the %3 replacement parameter.
Access levels are determined from the IP address of the client end of the TCP connection and the access level rules file (if any). In the absence of an access level rules file, TCPSRUN defaults to access level 1 for everything.
When applying rules from the rules file, more specific rules take precedence over less specific ones. In other words: If two rules would match an IP address, the one with the longer prefix takes precedence. If no rules match at all, the default is access level 0.
TCPSRUN can be managed as a service under RUNSVC, the Service Manager in the OS/2 Command Line Utilities version 2.2. A run file for such a service, in this case listening for HTTP connections on all IP addresses and invoking the program described in "TCPService.RUN", typically would look similar to:
program %APPS%\JdeBP\IU\bin\TCPSRun.exe chdir %_BOOT%:\Config\Services\%1 argument TCPSRun argument 0.0.0.0 argument www-http argument TCPService.RUN
This command listens for NNTP connections on a loopback IP address, and invokes the program described in "NNTPService.RUN":
[c:\]tcpsrun 127.0.0.1 nntp NNTPService.RUN