z/OS Communications Server: IP CICS Sockets Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


givesocket() call

z/OS Communications Server: IP CICS Sockets Guide
SC27-3649-00

The givesocket() call tells TCP/IP to make a specified socket available to a takesocket() call issued by another program. Any connected stream socket can be given. Typically, givesocket() is used by a parent server that obtains sockets by means of accept() and gives them to child servers that handle one socket at a time.

To pass a socket, the parent server first calls givesocket(), passing the name of the child server’s address space.

The parent server then uses the EXEC CICS® START command to start the child server. The START command uses the FROM data to pass the socket descriptor and the parent’s client ID that were previously returned by the socket() and getclientid() calls respectively.

The child server calls takesocket(), specifying the parent’s client ID and socket descriptor.

Having issued a givesocket() and started the child server that is to take the socket, the concurrent server uses select() to test the socket for an exception condition. When select() reports that an exceptional condition is pending, the concurrent server calls close() to free the socket. If the concurrent server closes the socket before a pending exception condition is indicated, the TCP connection is immediately reset, and the child server’s takesocket() call is unsuccessful.

When a program has issued a givesocket() call for a socket, it cannot issue any further calls for that socket, except close().

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014