SOC_Accept

C Specification

#include <nitroWiFi/soc.h>
int SOC_Accept ( int s, void* sockAddr );

Arguments

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))

Return Values

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. Please treat all negative return values as general errors.

Description

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, the socket for listening only runs when it is in block mode.
Also, there is no concept of a connection queue.

See Also

SOC_Socket, SOC_Bind, SOC_Connect, SOC_Listen, SOC_Fcntl

Revision History

09/13/2005 Initial version.
01/13/2006 Edited return values.