|
Answer» /* Code SAMPLE: MAKE a Socket a Listen-only Connection Endpoint - listen() by GlobalGuideline.com*/ #include <ltsys/types.h> #include <ltsys/socket.h> int listen(int s, int backlog) /* listen establishes the socket as a passive endpoint of a connection. It does not suspend process execution. */ /* No messages can be sent through this socket. Incoming messages can be received. */ /* s is the file descriptor associated with the socket created USING the socket() system CALL. backlog is the size of the queue of waiting REQUESTS while the server is busy with a service request. The current system-imposed maximum value is 5.
*/ /* 0 is returned on success, -1 on error with errno indicating the problem.
*/ Example: #include <ltsys/types.h> #include <ltsys/socket.h> int sockfd; /* socket file descriptor */ if(listen(sockfd, 5) < 0) printf ("listen error %dn", errno); /* Code Sample: Make a Socket a Listen-only Connection Endpoint - listen() by GlobalGuideline.com*/ #include <ltsys/types.h> #include <ltsys/socket.h> int listen(int s, int backlog) /* listen establishes the socket as a passive endpoint of a connection. It does not suspend process execution. */ /* No messages can be sent through this socket. Incoming messages can be received. */ /* s is the file descriptor associated with the socket created using the socket() system call. backlog is the size of the queue of waiting requests while the server is busy with a service request. The current system-imposed maximum value is 5. */ /* 0 is returned on success, -1 on error with errno indicating the problem. */ Example: #include <ltsys/types.h> #include <ltsys/socket.h> int sockfd; /* socket file descriptor */ if(listen(sockfd, 5) < 0) printf ("listen error %dn", errno);
|