listen

listen prepares the socket to accept incoming connections.

Syntax

Copy
int listen(
    SOCKET s,
    int backlog
);

Parameters

s

The socket accepting connections. Only sockets of type SOCK_STREAM apply.

backlog

Maximum number of pending connections permitted in the socket s connection queue. If a connection request arrives with the connection queue full, the connection request is ignored, so the retries may succeed.

If the backlog is not cleared when TCP times out, connect will fail with error WSA_ETIMEDOUT.

Return Value

If the function succeeds, it returns 0 (zero). If the function fails, it returns SOCKET_ERROR.

Use WSAGetLastError to retrieve a specific error code.

Requirements

Minimum supported version Header Library

eRTOS 1.0 SDK

Winsock2.h RtTcpipApi.lib