1socket_send4(3) Library Functions Manual socket_send4(3)
2
3
4
6 socket_send4 - send a UDP datagram
7
9 #include <socket.h>
10
11 ssize_t socket_send4(int s, const char* buf, size_t len,
12 const char ip[4],uint16 port);
13
15 socket_send4 sends len bytes starting at buf in a UDP datagram over the
16 socket s to UDP port port on IP address ip.
17
18 You can call socket_send4 without calling socket_bind4. This has the
19 effect as first calling socket_bind4 with IP address 0.0.0.0 and port
20 0.
21
23 socket_send4 returns 0 if the datagram was sent successfully. If not,
24 it returns -1 and sets errno appropriately.
25
27 #include <socket.h>
28
29 int s;
30 char ip[4];
31 uint16 p;
32
33 s = socket_tcp4();
34 socket_bind4(s,ip,p);
35 socket_send4(s,"hello, world",12,ip,p);
36
37
39 socket_send6(3)
40
41
42
43 socket_send4(3)