nn::socket::Accept Function
s32 Accept(
s32 s,
SockAddrIn * sockAddr
);
| 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. |
| Value | Description |
|---|---|
| 1 or higher | The new socket descriptor created in conjunction with accepting the connection. |
EAGAIN |
There are no unprocessed connection requests in the queue. This value is returned only in non-blocking mode. |
EBADF |
The socket descriptor is invalid. |
ECONNABORTED |
The connection was aborted for some reason. It is possible that the local host accepted a connection request from a remote host that then disconnected, or the connection was canceled for some reason (such as detection of a network interface disconnection). |
EINVAL |
Indicates an illegal call of one of the following. The socket has not used Listen to start accepting connection requests. The length of the socket address specified by sockAddr is invalid. |
EMFILE |
The maximum supported number of sockets has been exceeded. |
ENETDOWN |
The network is not available. |
ENETRESET |
Socket library is not initialized. |
ENOMEM |
Cannot allocate the memory required for the process. |
EOPNOTSUPP |
The socket is not a stream socket. |
EWOULDBLOCK |
Same as EAGAIN. |
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.
CONFIDENTIAL