1.1.27.9 listen

C

int listen(int fd, int backlog)

Description

Listen for connections on a socket.

Parameters

ParametersDescription
fdSocket file descriptor.
backlogMaximum number of pending connections.

Returns

  • 0 - Success.
  • -1 - Error, errno set.

Remarks

errnoDescription
EADDRINUSEThe referred to by fd is not bound to a local port.
EBADFThe argument fd is not a valid file descriptor.
ENOTSOCKThe file descriptor fd does not refer to a socket.
EOPNOTSUPPThe socket is not of a type that supports the listen() operation.
EAGAINThe socket is nonblocking, and the listening cannot be completed immediately.