listen

Top  Previous  Next

The listen function places a socket in a state in which it is listening for an incoming connection.

 

Syntax

int listen(

int socket,

int backlog

);

 

Parameters

socket

A descriptor identifying a bound, unconnected socket.

 

backlog

The maximum length of the queue of pending connections.

 

Return value

If no error occurs, listen returns 0 otherwise it returns -1. If an error occurs errno indicates the error.