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

7 Programming With the Sockets
Interface
107751 Tandem Computers Incorporated 7–1
The programming steps that are required for a client or server program to
communicate with TCP/IP are described in the Tandem TCP/IP Programming Manual or
Tandem TCP/IP Applications User's Manual, but there are some minor differences when
using RFC-1006, so this information is presented here for the reader's convenience.
Table 7-1 summarizes the steps followed by a detailed description of each step.
Table 7-1. Nowait Client and Server Steps
Client Server
1. Set TCP/IP process name
(socket_set_inet_name). (Optional)
1. Set TCP/IP process name
(socket_set_inet_name). (Optional)
2. Create a socket (socket_nw followed by
awaitiox).
2. Create a socket (socket_nw,followed by
awaitiox).
3. Bind the socket to any client port
(bind_nw followed by awaitiox).
3. Bind the socket to a well-known server port
(bind_nw followed by awaitiox).
4. Connect the socket to the server
(connect_nw followed by awaitiox).
4. Set the maximum queue length of pending
TCP incoming connections on the socket
(listen). *
5a. Await (listen) an incoming connection
(accept_nw followed by awaitiox). **
5b. When a connection has been received,
create a new socket (socket_nw followed by
awaitiox).
5c. Accept the new connection on the new
socket (accept_nw2 followed by awaitiox).
5. Start data transfer on the socket
(send_nw and/or recv_nw followed by
awaitiox usually in a loop).
6. Start data transfer on the new socket
created in step 5b (recv_nw and/or
send_nw, followed by awaitiox usually in a
loop).
6. Shut down the socket (shutdown_nw
followed by awaitiox). (Optional)
7. Shut down one or both sockets
(shutdown_nw followed by awaitiox).
(Optional)
7. Close the socket (close). 8. Close one or both of the sockets (close).
*
The LISTEN call does not perform a PASSIVE OPEN. See the directions for programming a client
on the following pages.
**
An ACCEPT_NW socket call will really perform a PASSIVE OPEN (LISTEN).
Programming a Client To interface with TCP/IP, the basic steps for a client 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.