1socket_listen(3) Library Functions Manual socket_listen(3)
2
3
4
6 socket_listen - attempt to make a TCP connection
7
9 #include <socket.h>
10
11 int socket_listen(int s,int n);
12
14 socket_listen prepares TCP socket s to accept TCP connections. It
15 allows a backlog of approximately n TCP SYNs. (On systems supporting
16 SYN cookies, the backlog is irrelevant.) Normally socket_listen returns
17 0.
18
19 If anything goes wrong, socket_listen returns -1, setting errno appro‐
20 priately.
21
22
24 #include <socket.h>
25
26 int s;
27 char ip[16];
28 uint16 p;
29
30 if ((s=socket_tcp6())==-1)
31 strerr_die2sys(111,FATAL,"unable to create TCP socket: ");
32 if (socket_bind6_reuse(s,(char *)V6any,8002,0) == -1)
33 strerr_die2sys(111,FATAL,"unable to bind: ");
34 if (socket_listen(s,1) == -1)
35 strerr_die2sys(111,FATAL,"unable to listen: ");
36
37
39 socket_connect4(3), socket_connect6(3)
40
41
42
43 socket_listen(3)