1socket_bind4_reuse(3) Library Functions Manual socket_bind4_reuse(3)
2
3
4
6 socket_bind4_reuse - set the local IP address and port of a socket
7
9 #include <socket.h>
10
11 int socket_bind4_reuse(int s,char ip[4],uint16 port);
12
14 socket_bind4_reuse sets the local IP address and TCP/UDP port of a
15 TCP/UDP socket s to ip and port respectively.
16
17 If the IP address is 0.0.0.0, the operating system chooses a local IP
18 address. If port is 0, the operating system chooses a port.
19
20 Normally socket_bind4_reuse returns 0. If anything goes wrong,
21 socket_bind4_reuse returns -1, setting errno appropriately.
22
23 Unlike socket_bind4 this function will also tell the operating system
24 that the address is to be reused soon, which turns off the normal pause
25 before this IP and port can be bound again.
26
28 #include <socket.h>
29
30 int s;
31 char ip[4];
32 uint16 p;
33
34 s = socket_tcp4();
35 socket_bind4_reuse(s,ip,p);
36 socket_connect4(s,ip,p);
37
38
40 socket_bind6(3)
41
42
43
44 socket_bind4_reuse(3)