Sets the maximum limit of outstanding connection requests for a
socket that is connection-oriented.
Format
int listen (int s, int backlog);
Arguments
- s
- A socket descriptor of type SOCK_STREAM that has been created
using socket.
- backlog
- The maximum number of pending connections that may be queued on
the socket at any given time. The maximum cannot exceed 5.
Description
This routine creates a queue for pending connection requests
on socket s with a maximum size of backlog.
Connections may then be accepted with accept.
If a connection request arrives with the queue full (more than
backlog connection requests pending), the client will
receive a timeout.
See also accept, connect, and socket in this section.
Return Values
0 | Indicates success. |
-1 | Indicates an error; errno is set to one
of the following values:
- EBADF - The socket descriptor is invalid.
- ENOTSOCK - The socket descriptor references a file, not a
socket.
- EOPNOTSUPP - The socket is not of a type that supports the
operation listen.
|
Previous Page | Next Page | Table of Contents | Index