1socket_bind6(3) Library Functions Manual socket_bind6(3)
2
3
4
6 socket_bind6 - set the local IP address and port of a socket
7
9 #include <socket.h>
10
11 int socket_bind6(int s, char ip[16], uint16 port,
12 uint32 scope_id);
13
15 socket_bind6 sets the local IP address and TCP/UDP port of a TCP/UDP
16 socket s to ip and port respectively.
17
18 If the IP address is ::, the operating system chooses a local IP
19 address. If port is 0, the operating system chooses a port.
20
21 Normally socket_bind6 returns 0. If anything goes wrong, socket_bind6
22 returns -1, setting errno appropriately.
23
24 The scope_id should normally be zero, but for link-local addresses it
25 specifies the interface number on which to bind. The interface number
26 for a given network interface name can be found with socket_getifidx.
27
29 #include <socket.h>
30
31 int s;
32 char ip[16];
33 uint16 p;
34 uint32 scope_id;
35
36 s = socket_tcp6();
37 socket_bind6(s,ip,p,scope_id);
38 socket_connect6(s,ip,p);
39
40
42 socket_bind4(3), socket_getifidx(3)
43
44
45
46 socket_bind6(3)