nn::socket::Accept Function

Syntax

s32 Accept(
     s32 s,
     SockAddrIn * sockAddr
);

Arguments

Name Description
in s Specifies a socket descriptor. Specifies a socket descriptor created using the Socket function, to which the Bind function has bound an address, and for which a Listen function call succeeded.
out sockAddr Specifies a pointer to a socket address structure for recording the socket address of accepted connection partners.

Return Values



Value Description
1 or higher Socket descriptor of the accepted connection.
EINVAL Invalid processing.
ENETRESET Socket library is not initialized.
EBADF Invalid socket descriptor.
EOPNOTSUPP Process not supported.
ENOBUFS Insufficient resources.
EAGAIN O_NONBLOCK is set in the socket descriptor and there is no connection currently available for acceptance.
ECONNABORTED The connection was cancelled.
ENOMEM Insufficient memory.

Description

Accepts incoming connections.

Retrieves the first new socket connection from the connection queue; creates a new socket with the same socket type, protocol, and address family as the specified socket; and returns the new socket descriptor. The original socket is left to continue receiving connection requests.

Unless the socket descriptor is set to blocking mode using the Fcntl function, Accept blocks so long as there are no unprocessed connections in the queue.

This function allocates a backlog of one item in place of the retrieved new socket, but if no backlog could be allocated due to insufficient memory or some other limitation, this function returns ENOMEM, regardless of whether there are any incoming connections.

See Also

Fcntl, GetPeerName, Listen

Revision History

2010/06/14
Initial version.

CONFIDENTIAL