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(
[in] SOCKET s,
[out] struct sockaddr *addr,
[in, out] int *addrlen
);
Parameters
[in] s
A descriptor for a stream socket in the listening state with the listen function.
[out] addr
A pointer to the addr structure where the source address of the connection request will be received.
[in, out] 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, the value of the socket descriptor is greater than or equal to zero. If the function fails, it returns INVALID_SOCKET. Call WSAGetLastError to retrieve a specific error code.
Requirements
| Minimum supported version | Header | Library |
|---|---|---|
|
wRTOS 1.0 SDK |
winsock2.h |
RttcpipApi.lib |