- 论坛徽章:
- 0
|
listen(SSC)
***********
____________________________________________________________________________
listen -- listen for connections on a socket
Syntax
======
cc . . . -lsocket
int listen (s, backlog)
int s, backlog;
Description
===========
To accept connections, a socket is first created with socket(SSC), a backlog
for incoming connections is specified with listen, and then the connections
are accepted with accept(SSC). The listen call applies only to sockets of
type SOCK_STREAM.
The backlog parameter defines the maximum length to which the queue of
pending connections may grow. If a connection request arrives with the
queue full, the client will receive an error with an indication of
ECONNREFUSED.
Return values
=============
A return value of zero indicates that the call succeeded. A return value of
-1 indicates that an error occurred, and in this case an error code is
stored in the global variable errno.
Errors
======
The call fails if:
[EBADF]
The argument s is not a valid descriptor.
[ENOTSOCK]
The argument s is not a socket.
[EOPNOTSUPP]
The socket is not of a type that supports the operation listen.
Notes
=====
The backlog is currently limited (silently) to 5. //默认是5 |
|