bind -a '#I' /net /net/tcp/clone /net/tcp/<n> /net/tcp/<n>/data /net/tcp/<n>/ctl /net/tcp/<n>/local /net/tcp/<n>/remote /net/tcp/<n>/status /net/tcp/<n>/listen ...
Each of the protocols is served by the IP device, which represents each connection by a set of device files. The top level directory of each protocol contains a clone file and subdirectories numbered from 0 to the number of connections configured for this protocol.
Prior to sending data, remote and local addresses must be set for the connection. For outgoing calls the local port number will be allocated randomly if none is set. Addresses are set by writing control messages to the ctl file of the connection. The connection is not established until the data file is opened. For TCP, the process will block until the remote host has acknowledged the connection. UDP opens always succeed.
Control messages
The following control messages are supported: connect
connect ipaddress! port [!r]
Set the remote IP address and port number for the connection. If the r flag is supplied and no local address has been specified the system allocates a restricted port number (less than 1024) for the connection to allow communication with Unix machines' login and exec services. announce
announce X
X is a decimal port number or *. Set the local port number to X and accept calls to X. If X is *, accept calls for any port that no process has explicitly announced. The local IP address cannot be set. The announce attempt fails if the connection is already announced or connected. bind
bind X
X is a decimal port number or *. Set the local port number to X. This exists to support emulation of BSD sockets and is not used otherwise. header (UDP only)
header
Skip headers on reads and writes. Notes
Port numbers must be in the range 1 to 32767. If a local port has not been announced prior to a connect a local port number is automatically allocated. Local ports are numbers greater than or equal to 5000.
The dial, announce, and listen functions in the Sys module provide an alternate method to perform the necessary I/O to establish and manipulate network connections.
See Also
dial, announce, export, listen - make network connections in Chapter 8