Close

Read syntax diagramSkip visual syntax diagram SOCKET ( ' CLOSE ' , socketid )

Purpose

Use the Close function to shut down a socket and free the resources allocated to it. If the socket ID refers to an open TCP connection, the connection is closed. If a stream socket is closed when there is input data queued, the TCP connection is reset rather than closed.

Parameters

socketid
is the identifier of the socket to be closed.

Usage Notes

The SO_LINGER socket option, which is set by the SetSockOpt function, can be used to control how unsent output data is handled when a stream socket is closed. See SetSockOpt.

Return Values

If successful, this function returns a string containing only return code 0. If unsuccessful, this function returns a string containing a nonzero return code, an error name, and an error message.

Examples

Call
Return Values
Socket('Close',6)
'0'

The C socket call is: close(s)

Messages and Return Codes

For a list of REXX Sockets system messages, see REXX Sockets System Messages. For a list of REXX Sockets return codes, see REXX Sockets Return Codes.