#include <nitroWiFi/soc.h>
int SOC_Accept ( int s, void* sockAddr );
s |
A socket that was created with SOC_Socket(), bound to an address with SOC_Bind(), and used to call SOC_Listen() successfully. |
sockAddr |
Specifies either a null pointer or a pointer to the socket address structures SOCSockAddr and SOCSockAddrIn used to record the socket address of the accepted connection partner.If a non-null pointer is specified, please correctly initialize the len field in the socket address. (Example: sizeof(SOCSockAddrIn)) |
| 0 or higher | Socket descriptor of the accepted connection. |
SOC_EALREADY |
Starting the connection process. |
SOC_EINVAL |
Invalid processing. (Starting connection processing, Not a TCP socket, Listening socket is not valid, etc.) |
SOC_EMFILE |
Cannot create any more socket descriptors. |
SOC_ENETRESET |
Socket is not initialized. |
SOC_ENOBUFS |
Insufficient resources. |
SOC_ENOMEN |
Insufficient memory. |
SOC_ETIMEDOUT |
TCP connection timeout. |
SOC_EWOULDBLOCK |
The function can only be executed in blocked mode. If the socket used for listening is unblocked, this error code is returned and execution terminates. |
Note: Additional errors may be generated and returned in future library releases. Treat all negative return values as general errors.
This function removes a connection request from the front of the connection queue, creates a new socket having same socket type, protocol and address family as the specified socket, and returns the descriptor of the new socket. The original socket remains unchanged so that it can accept more connection requests.
Currently, this function creates and binds sockets according to CPS specifications, and because listen and accept are performed simultaneously, this function operates only when the socket for listening is in block mode.
Also, there is no concept of a connection queue.
SOC_Socket, SOC_Bind, SOC_Connect, SOC_Listen, SOC_Fcntl
2005/09/13 Initial version.
2006/01/13 Edited return values.
CONFIDENTIAL