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: - 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.
- 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.
- 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:
Authorization: |
Supervisor state or problem state, any PSW key. |
Dispatchable unit mode: |
Task. |
Cross memory mode: |
PASN = HASN. |
Amode: |
31-bit or 24-bit.
|
ASC mode: |
Primary address space control (ASC) mode. |
Interrupt status: |
Enabled for interrupts. |
Locks: |
Unlocked. |
Control parameters: |
All parameters must be addressable by the caller
and in the primary address space. |
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.