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.
EBADF The socket descriptor is invalid.
ENETDOWN The network is not available.
ENETRESET Socket library is not initialized.
ENOMEM Cannot allocate the memory required for the process.

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.
When you close a stream socket (SOCK_STREAM) that has not been set to non-blocking mode using the Fcntl function, the connection is closed in compliance with the Linger option setting.
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