z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


CLOSE

z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
SC27-3660-00

The CLOSE call performs the following functions:
  • The CLOSE call shuts down a socket and frees all resources allocated to it. If the socket refers to an open TCP connection, the connection is closed.
  • The CLOSE call is also issued by a concurrent server after it gives a socket to a child server program. After issuing the GIVESOCKET and receiving notification that the client child has successfully issued a TAKESOCKET, the concurrent server issues the close command to complete the passing of ownership. In high-performance, transaction-based systems the timeout associated with the CLOSE call can cause performance problems. In such systems you should consider the use of a SHUTDOWN call before you issue the CLOSE call. See SHUTDOWN for more information.
    Notes:
    1. If a stream socket is closed while input or output data is queued, the TCP connection is reset and data transmission may be incomplete. The SETSOCKOPT call can be used to set a linger condition, in which TCP⁄IP will continue to attempt to complete data transmission for a specified period of time after the CLOSE call is issued. See SO-LINGER in the description of SETSOCKOPT.
    2. A concurrent server differs from an iterative server. An iterative server provides services for one client at a time; a concurrent server receives connection requests from multiple clients and creates child servers that actually serve the clients. When a child server is created, the concurrent server obtains a new socket, passes the new socket to the child server, and then dissociates itself from the connection. The CICS® Listener is an example of a concurrent server.
    3. After an unsuccessful socket call, a close should be issued and a new socket should be opened. An attempt to use the same socket with another call results in a nonzero return code.
The following requirements apply to this call:

Figure 1 shows an example of CLOSE call instructions.

Figure 1. CLOSE call instruction example
    WORKING-STORAGE SECTION.
        01 SOC-FUNCTION PIC X(16) VALUE IS 'CLOSE'.
        01 S PIC 9(4) BINARY.
        01 ERRNO PIC 9(8) BINARY.
        01 RETCODE PIC S9(8) BINARY.

    PROCEDURE DIVISION.
        CALL 'EZASOKET' USING SOC-FUNCTION S ERRNO RETCODE.

For equivalent PL/I and assembler language declarations, see Converting parameter descriptions.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014