1socket_recv6(3) Library Functions Manual socket_recv6(3)
2
3
4
6 socket_recv6 - receive a UDP datagram
7
9 #include <socket.h>
10
11 ssize_t socket_recv6(int s, char* buf, size_t len,
12 char ip[16], uint16* port, uint32* scope_id);
13
15 socket_recv6 receives up to len bytes starting at buf from a UDP data‐
16 gram coming in on the socket s. It writes the UDP port to port and the
17 IP address to ip, and returns the number of bytes actually received (or
18 -1 if anything went wrong).
19
20 For link-local addresses, scope_id will become the network interface
21 number, which can be translated into the name of the interface ("eth0")
22 with socket_getifname.
23
25 socket_recv6 returns the number of bytes in the datagram if one was
26 received. If not, it returns -1 and sets errno appropriately.
27
29 #include <socket.h>
30
31 int s;
32 char ip[16];
33 uint16 p;
34 char buf[1000];
35 int len;
36 uint32 scope_id;
37
38 s = socket_tcp4();
39 socket_bind6(s,ip,p);
40 len = socket_recv6(s,buf,sizeof(buf),ip,&p,&scope_id);
41
42
44 socket_recv4(3), socket_getifname(3)
45
46
47
48 socket_recv6(3)