1socket_accept6(3) Library Functions Manual socket_accept6(3)
2
3
4
6 socket_accept6 - accept an IPv6 TCP connection on a socket
7
9 #include <socket.h>
10
11 int socket_accept6(int s,char ip[16],uint16 *port,uint32 *scope_id);
12
14 When a TCP connection arrives on a listening TCP socket s, the socket
15 becomes readable.
16
17 socket_accept6 accepts the connection. It sets ip and port to the
18 client IP address and client TCP port and scope_id to the IPv6 scope
19 ID. It creates a new socket for the connection, and returns a file
20 descriptor pointing to the new socket; you can use the read and write
21 system calls to transmit data through that file descriptor.
22
23 If scope_id is the null pointer, socket_accept6 will discard the scope
24 ID.
25
26 If something goes wrong, socket_accept6 returns -1, setting errno
27 appropriately, without creating a new socket.
28
29
31 #include <socket.h>
32
33 int s;
34 char ip[16];
35 uint16 port;
36 uint32 scope_id;
37
38 s = socket_tcp6();
39 socket_bind6(s,ip,port,scope_id);
40 socket_listen(s,16);
41 socket_accept6(s,ip,&port,&scope_id);
42
43
45 socket_accept4(3), socket_connected(3)
46
47
48
49 socket_accept6(3)