#include <rtl.h>
int closesocket (
int sock); /* Socket descriptor */
Description
The closesocket function closes an existing socket and
releases the socket descriptor. Further references to sock
fail with SCK_EINVALID error code.
The argument sock specifies a socket descriptor returned
from a previous call to socket.
In blocking mode, which is enabled if the system detects RTX
environment, this functions waits until a socket is closed. In non
blocking mode, you must call the closesocket function again if
the error code SCK_EWOULDBLOCK is returned.
The closesocket function is in the RL-TCPnet library. The
prototype is defined in rtl.h.
note
You must call the socket function before any other
function calls to the BSD socket.
If a negative number is returned, it represents an error
code.
Return Value
The closesocket function returns the following result:
SCK_SUCCESS
The function call is successful.
SCK_EINVALID
The socket identified with sock is invalid.
SCK_EWOULDBLOCK
The function would block, and the socket is set to non blocking
mode.
SCK_ELOCKED
The sock is locked by another task in RTX environment.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.