nn::socket::Close Function

Syntax

s32 Close(
     s32 s
);

Arguments

Name Description
in s Specifies the socket descriptor. Specify a socket descriptor created using the Socket or Accept function.

Return Values



Value Description
0 Process was successful.
ENETRESET Socket library is not initialized.
EBADF Invalid socket descriptor.
ENOTCONN Not connected.
EINVAL Invalid processing.

Description

Closes a socket. Closed sockets can no longer be used.

If there are currently any blocked function calls that used the socket that this function closes, the blocks are released and those functions return their various predefined errors. If you close a stream socket (SOCK_STREAM) that has not been set to non-blocking mode by the Fcntl function, the connection is closed according to the configured Linger options. The default behavior is for Close to return immediately without blocking. Then, after any data remaining to be sent is automatically transferred in the background, the resources used by the socket are released.

See Also

Socket, Fcntl, Shutdown

Revision History

2010/06/14
Initial version.

CONFIDENTIAL