listen Function
C
int listen(
SOCKET s,
int backlog
);
Description
This function sets the specified socket in a listen mode. Calling the listen function indicates that the application is ready to accept connection requests arriving at a socket of type SOCK_STREAM. The connection request is queued (if possible) until accepted with an accept function. The backlog parameter defines the maximum number of pending connections that may be queued.
Preconditions
bind() must have been called on the s socket first.
Parameters
Parameters | Description |
---|---|
s | Socket identifier returned from a prior socket() call. |
backlog | Maximum number of connection requests that can be queued. Note that each backlog requires a TCP socket to be allocated. |
Returns
0 - The function was successful.
SOCKET_ERROR (-1) - Function failed. errno is set accordingly.
Remarks
None.