Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/l/listen.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/l/listen.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/l/listen.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/l/listen.html on line 8
Listen for connections on a socket
#include <sys/socket.h>
int listen( int s,
int backlog );
- s
- The descriptor for the socket that you want to listen on.
You can create a socket by calling
socket().
- backlog
- The maximum length that the queue of pending connections may grow to.
libsocket
Use the -l socket option to
qcc
to link against this library.
The listen() function listens for connections on a socket and
puts the socket into the LISTEN state.
For connections to be accepted, you must:
- Create a socket by calling socket().
- Indicate a willingness to accept incoming connections and a queue
limit for them by calling listen().
- Call
accept()
to accept the connections.
If a
connection request arrives with the queue full, the client
may receive an error with an indication of ECONNREFUSED. But
if the underlying protocol supports retransmission, the
request may be ignored so that retries may succeed.
|
The listen() call applies only to SOCK_STREAM sockets.
|
- 0
- Success.
- -1
- An error occurred
(errno
is set).
- EBADF
- Invalid descriptor s.
- EOPNOTSUPP
- The socket isn't of a type that supports the listen() operation.
POSIX 1003.1
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |
accept(),
connect(),
socket()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/l/listen.html on line 184
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/l/listen.html on line 184