1socket_bind6_reuse(3) Library Functions Manual socket_bind6_reuse(3)
2
3
4
6 socket_bind6_reuse - set the local IP address and port of a socket
7
9 #include <socket.h>
10
11 int socket_bind6_reuse(int s,char ip[16],uint16 port,
12 uint32 scope_id);
13
15 socket_bind6_reuse sets the local IP address and TCP/UDP port of a
16 TCP/UDP 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_reuse returns 0. If anything goes wrong,
22 socket_bind6_reuse 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
28 Unlike socket_bind6 this function will also tell the operating system
29 that the address is to be reused soon, which turns off the normal pause
30 before this IP and port can be bound again.
31
33 #include <socket.h>
34
35 int s;
36 char ip[16];
37 uint16 p;
38
39 s = socket_tcp4();
40 socket_bind6_reuse(s,ip,p);
41 socket_connect4(s,ip,p);
42
43
45 socket_bind6(3)
46
47
48
49 socket_bind6_reuse(3)