TCP/IP Programming Manual
Table 2 TCP—Nowait Client and Server Steps
ServerClient
Optionally, set NonStop TCP/IP, TCPSAM, or
TCP6SAM process name
(socket_set_inet_name).
1.Optionally, set NonStop TCP/IP,
TCPSAM, or TCP6SAM process name
(socket_set_inet_name).
1.
Create a socket (socket_nw, followed by
AWAITIOX).
2.Create a socket (socket_nw, followed
by AWAITIOX).
2.
Bind the socket to a well-known port (bind_nw,
followed by AWAITIOX).
3.Optionally, bind the socket to any port
(bind_nw, followed by AWAITIOX).
3.
Listen for connections (listen).4.Connect the socket to the server
(connect_nw, followed by AWAITIOX).
4.
Accept the connection.5.
a. Accept an incoming connection (accept_nw,
followed by AWAITIOX).
b. Create a new socket (socket_nw) with (flags
& 0200) nowait set.c. Call AWAITIOX, followed
by SETMODE 30, followed by AWAITIOX).
d. Accept the new connection on the new socket
(accept_nw2, followed by AWAITIOX).
Start data transfer on the new socket (recv_nw
and/or send_nw, followed by AWAITIOX, usually
in a loop).
6.Start data transfer (send_nw and/or
recv_nw, followed by AWAITIOX,
usually in a loop).
5.
Optionally, shut down one or both sockets
(shutdown_nw, followed by AWAITIOX).
7.Optionally, shut down the socket
(shutdown_nw, followed by AWAITIOX).
6.
Close the socket (CLOSE or FILE_CLOSE_).8.Close the socket (CLOSE or
FILE_CLOSE_).
7.
UDP Client and Server Programs
Table 3 shows the steps performed by a UDP client and a UDP server in waited operations.
Table 3 UDP—Waited Client and Server Steps
ServerClient
Optionally, set NonStop TCP/IP, TCPSAM, or
TCP6SAM process name
(socket_set_inet_name).
1.Optionally, set NonStop TCP/IP, TCPSAM,
or TCP6SAM process name
(socket_set_inet_name).
1.
Create a socket (socket).2.Create a socket (socket).2.
Bind the socket to a well-known port (bind).3.Optionally, bind the socket to any port
(bind).
3.
Start data transfer (recvfrom and/or sendto,
usually in a loop).
4.Start data transfer (sendto and/or
recvfrom, usually in a loop).
4.
OROR
Specify the remote address for the socket
(connect). Then, start data transfer on the socket
(recv and/or send, usually in a loop).
Specify the remote address for the socket
(connect). Then, start data transfer (send
and/or recv, usually in a loop).
Close the socket (CLOSE or FILE_CLOSE_).5.Close the socket (CLOSE or
FILE_CLOSE_).
5.
40 Introduction to Programming to the Guardian Sockets Library