CLOSE

The CLOSE macro shuts down the socket and frees the resources that are allocated to the socket.

Issue the SHUTDOWN macro before you issue the CLOSE macro.

CLOSE can also be issued by a concurrent server after it gives a socket to a subtask program. After issuing GIVESOCKET and receiving notification that the client child has successfully issued TAKESOCKET, the concurrent server issues the CLOSE macro to complete the transfer of ownership.

Note: If a stream socket is closed while input or output data is queued, the stream connection is reset and data transmission can be incomplete. SETSOCKET can be used to set a SO_LINGER condition, in which TCP/IP continues to send data for a specified period of time after the CLOSE macro is issued. For information about SO_LINGER, see SETSOCKOPT.

Format

Read syntax diagramSkip visual syntax diagramEZASMITYPE=CLOSE,S= numberaddress*indaddr(reg),ERRNO= address*indaddr(reg),RETCODE= address*indaddr(reg),ECB=address* indaddr( reg),ERROR=address*indaddr(reg),TASK=address*indaddr(reg)

Parameters

S
Input parameter. A value or the address of a halfword binary number specifying the socket to be closed.
ERRNO
Output parameter. A fullword binary field. If RETCODE is negative, ERRNO contains a valid error number. Otherwise, ignore ERRNO.

See ERRNO Values, for information about ERRNO return codes.

RETCODE
A fullword binary field that returns one of the following:
Value
Description
0
Successful call
-1
Check ERRNO for an error code
ECB
Input parameter. It points to a 160-byte field containing:
  • A four-byte ECB posted by TCP/IP when the macro completes.
  • A 156-byte storage field used by the interface to save the state information.
Note: This storage must not be modified until the macro function has completed and the ECB has been posted.
ERROR
Input parameter. The location in your program to receive contro, if the application programming interface (API) processing module cannot be loaded.
TASK
Input parameter. The location of the task storage area in your program.