![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
| listen | 
| Portability: | UNIX compatible | 
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| PORTABILITY | |
| RELATED FUNCTIONS | 
| SYNOPSIS | 
#include <sys/types.h> #include <sys/socket.h> int listen(int s, int backlog);
| DESCRIPTION | 
listen
 indicates that the socket descriptor 
s
 is ready to accept incoming connection requests.  
backlog
 is an integer defining the maximum
length
of the queue of connection requests.  The SOMAXCONN constant in the 
<socket.h>
 header file defines
the maximum value for the 
backlog
 parameter.  Currently, 
SOMAXCONN
 is 
10
.
The connections are accepted with 
accept
.  Servers typically use this call in preparation for service
requests from clients.
| RETURN VALUE | 
If 
listen
 succeeds, it returns a 
0
.   Otherwise, it returns a 
-1
, and sets 
errno
to indicate the type of error.
| PORTABILITY | 
listen
 is portable to other environments, including most UNIX systems,
that implement BSD sockets.
| RELATED FUNCTIONS | 
![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
![]() Top of Page  | 
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.