listen()

Sets up a listen queue for the specified socket on the server process and listens for connection requests.

Syntax

result = listen(socket, backlog)

int result, socket, backlog;

Parameters

result

0 if listen() is successful.

 

-1if a failure occurs.

socket

Socket descriptor of a local socket.

backlog

Defines the maximum allowable length of the queue for

 

pending connections. The current valid range for backlog is 1

 

to 5. If any other value is specified, the system automatically

 

assigns the closest value within range. If the queue is greater

 

than the backlog, additional incoming requests will be rejected.

48 Berkeley Software Distribution Interprocess Communication