gtpc1m3c | Transmission Control Protocol/Internet Protocol |
The TPF system provides the activate_on_receipt function, a
unique TPF socket API function designed to prevent many ECBs from being
suspended at the same time. See the drivers in Appendix D, Sample Application Driver Code for an example of how to use the
activate_on_receipt function. The following steps correspond
to the numbers in Figure 24:
- The server is started first by issuing a socket call to create
socket s. The client then issues a socket to
create its own socket s. A socket is initially created in
the unconnected state, which means that the socket is not associated with any
remote destination.
- Using the listen function, the server issues a bind
call to a local address to be positioned for a subsequent connection.
The client can issue an optional bind call to a local
address.
- The server waits for a connection from the client.
- The connect call places the socket in the connected
state. The client must issue the connect call
before being able to transfer data through a reliable stream socket.
- The server issues an accept call to accept an incoming
connection. To allow the server socket s to remain available
for the next client connection, the accept call creates a new
socket ns, which is dedicated to the client.
- The server issues an activate_on_receipt function to create a
new ECB and activate a new child server program when data is received from the
client. The original server becomes a parent server.
- When the child server program is activated, the read and
write calls between the client and child server continue until all
the data is transferred.
- The client closes socket s and the child server closes the
related socket, socket ns. The parent server can continue to
accept other connections on the original socket s or close
it.
Figure 24. Using the activate_on_receipt Function Call