listen Function

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
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 
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_PURPOSE_BERKELEY_SERVER type TCP socket to be allocated in the TCPSocketInitializer[] in TCPIPConfig.h. Also, ensure that BSD_SOCKET_COUNT (also in TCPIPConfig.h) is greater than the backlog by at least 1 (more if you have other BSD sockets in use). 
Returns

Returns 0 on success, else return SOCKET_ERROR.

Remarks

None

Microchip TCP/IP Stack 5.42.08 - June 15, 2013
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.