`generate_port', `try_bind_listen', `try_connect', `try_accept', `register_server'
----------------------------------------------------------------------------------

generate_port([USE_UNIX])
     :: Generates a port number.

try_bind_listen(PORT)
     :: Binds and listens on a port.

try_connect(HOST,PORT)
     :: Connects to a port.

try_accept(SOCKET,PORT)
     :: Accepts a connection request.

register_server(CONTROL_SOCKET,CONTROL_PORT,SERVER_SOCKET,SERVER_PORT)
     :: Registers the sockets for which connections are established.

RETURN
     integer or string for `generate_port()', integer for the others

USE_UNIX
     0 or 1

HOST
     string

PORT,CONTROL_PORT,SERVER_PORT
     integer or string

SOCKET,CONTROL_SOCKET,SERVER_SOCKET
     integer

   * These functions are primitives to establish communications between
     a client and servers.

   * `generate_port()' generates a port name for communication.  If the
     argument is not specified or equal to 0, a port number for
     Internet domain socket is generated randomly. Otherwise a file
     name for UNIX domain (host-internal protocol) is generated.  Note
     that it is not assured that the generated port is not in use.

   * `try_bind_listen()' creates a socket according to the protocol
     family indicated by the given port and executes `bind' and
     `listen'.  It returns a socket identifier if it is successful. -1
     indicates an error.

   * `try_connect()' tries to connect to a port PORT on a host HOST.
     It returns a socket identifier if it is successful. -1 indicates
     an error.

   * `try_accept()' accepts a connection request to a socket SOCKET.
     It returns a new socket identifier if it is successful. -1
     indicates an error.  In any case SOCKET is automatically closed.
     PORT is specified to distinguish the protocol family of SOCKET.

   * `register_server()' registers a pair of a control socket and a
     server socket. A process identifier indicating the pair is
     returned.  The process identifier is used as an argument of `ox'
     functions such as `ox_push_cmo()'.

   * Servers are invoked by using `shell()', or manually.

     [340] CPort=generate_port();
     39896
     [341] SPort=generate_port();
     37222
     [342] CSocket=try_bind_listen(CPort);
     3
     [343] SSocket=try_bind_listen(SPort);
     5
     
     /*
     ox_launch is invoked here :
     %  ox_launch "127.1" 0 39716 37043 ox_asir "shio:0"
     */
     
     [344] CSocket=try_accept(CSocket,CPort);
     6
     [345] SSocket=try_accept(SSocket,SPort);
     3
     [346] register_server(CSocket,CPort,SSocket,SPort);
     0

References
     *Note `ox_launch ox_launch_nox ox_shutdown': ox_launch
     ox_launch_nox ox_shutdown, *Note `ox_launch_generic':
     ox_launch_generic, *Note `shell': shell, *Note `ox_push_cmo
     ox_push_local': ox_push_cmo ox_push_local

