OSI/AS and OSI/TS Supplement (Includes RFC-1006 Support)

Programming a Server
Programming With the Sockets Interface
7–2 107751 Tandem Computers Incorporated
2. Create a socket.
The call to SOCKET_NW creates a socket. As part of its operation, it calls the
OPEN procedure to open a file for interprocess communication. The socket
number it returns actually is the file number obtained from OPEN.
3. Bind the socket to the local IP address and any client port from 1024 up.
The BIND_NW call associates any local client port and the local Internet address
with the socket. The port number for an ACTIVE OPEN should be from 1024 up.
Ports 1 to 1023 are reserved for well-known ports for server service.
In RFC-1006, the transport initiator calls BIND_NW without specifying the local
client port number and let TCP assign a port. The local IP address is optional.
4. Connect the socket to the server.
The CONNECT_NW call associates the remote well-known server port and the
remote Internet address with the socket. To connect with a remote transport
server, use the well-known port 102.
For each new TCP connection request, the client needs to perform steps 1 to 4
again. Since a TSP process can be configured to interface with multiple TCP/IP
processes, step 1 is repeated.
5. Start data transfer.
For sending and receiving data, use SEND_NW and RECV_NW calls on the
socket.
6. Shut down the socket (optional).
The SHUTDOWN_NW call shuts down data transfer on the actively connected
TCP socket, either partially or completely (preventing further reads, writes, or
both). Calling SHUTDOWN is optional; if it is not done, the call to CLOSE
performs the implicit SHUTDOWN function.
7. Close the socket.
When the communication is complete, the CLOSE procedure must be explicitly
called to close the socket. If the SHUTDOWN_NW call has not been called,
internally TCP will still perform the SHUTDOWN function.
Programming a Server To interface with TCP/IP, the basic steps for a server are as follows:
1. Designate the process name of the TCP/IP process (optional)
To create a socket, the socket library opens a file to communicate with the TCP/IP
process. Therefore, the socket library must know the name of this process before
any sockets are created. The TSP process specifies this process explicitly by calling
the function SOCKET_SET_INET_NAME.