INtime SDK Help
listen (legacy networking)
INtime Help

Listens for connection requests on a socket.

int listen(
  int s,
  int backlog
);

Parameters

s
An unconnected socket of type SOCK_STREAM, which has been bound to a name with bind.
backlog
The maximum number of incoming connection requests that can be queued. If a connection request arrives with the queue full, the client will receive an error.

Remarks

For a server application to accept connections, it must first create a socket with socket( ), then specify a backlog for incoming connection requests with listen. To complete a connection, accept connection requests with accept.

A listen(s, 0) call succeeds and sets a connection queue length of 0. This causes all connect attempts to the listening port to fail, an error. A listen(s, 1) call accepts only a single connection with no pending requests allowed.

Return Values

0 (zero)
Success.
-1 and the function sets errno to one of these values
EBADF Invalid file descriptor or file not opened for writing.
ENOSPC No space left on device.
Failure.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/sys/socket.h sys/types.h
sys/socket.h
netiff3m.lib
See Also