1socket_bind4(3) Library Functions Manual socket_bind4(3)
2
3
4
6 socket_bind4 - set the local IP address and port of a socket
7
9 #include <socket.h>
10
11 int socket_bind4(int s,char ip[4],uint16 port);
12
14 socket_bind4 sets the local IP address and TCP/UDP port of a TCP/UDP
15 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 returns 0. If anything goes wrong, socket_bind4
21 returns -1, setting errno appropriately.
22
23
25 #include <socket.h>
26
27 int s;
28 char ip[4];
29 uint16 p;
30
31 s = socket_tcp4();
32 socket_bind4(s,ip,p);
33 socket_connect4(s,ip,p);
34
35
37 socket_bind6(3)
38
39
40
41 socket_bind4(3)