accept
accept returns a new socket that corresponds to an established connection from the listening socket queue. This function applies only to stream sockets.
Syntax
SOCKET accept(
SOCKET s,
struct sockaddr *addr,
int *addrlen
);
Parameters
s
A socket descriptor for a stream socket in the listening state with the listen function.
addr
A pointer to addr structure where the source address of the connection request will be received.
addrlen
A pointer to an integer containing the size of the given space pointed to by addr. Upon return, addrlen shall be modified to reflect the size of the address returned in addr.
Return Value
If the function succeeds, it returns a socket descriptor (>= 0). If the function fails, it returns INVALID_SOCKET.
Use WSAGetLastError to retrieve a specific error code.
Requirements
Minimum supported version | Header | Library |
---|---|---|
eRTOS 1.0 SDK |
Winsock2.h | RtTcpipApi.lib |