.TH socket_recv6 3 .SH NAME socket_recv6 \- receive a UDP datagram .SH SYNTAX .B #include ssize_t \fBsocket_recv6\fP(int \fIs\fR, char* \fIbuf\fR, size_t \fIlen\fR, char \fIip\fR[16], uint16* \fIport\fR, uint32* \fIscope_id\fR); .SH DESCRIPTION socket_recv6 receives up to \fIlen\fR bytes starting at \fIbuf\fR from a UDP datagram coming in on the socket \fIs\fR. It writes the UDP port to \fIport\fR and the IP address to \fIip\fR, and returns the number of bytes actually received (or -1 if anything went wrong). For link-local addresses, \fIscope_id\fR will become the network interface number, which can be translated into the name of the interface ("eth0") with socket_getifname. .SH RETURN VALUE socket_recv6 returns the number of bytes in the datagram if one was received. If not, it returns -1 and sets errno appropriately. .SH EXAMPLE #include int \fIs\fR; char \fIip\fR[16]; uint16 \fIp\fR; char buf[1000]; int len; uint32 scope_id; \fIs\fR = socket_tcp4(); socket_bind6(s,ip,p); len = socket_recv6(s,buf,sizeof(buf),ip,&p,&scope_id); .SH "SEE ALSO" socket_recv4(3), socket_getifname(3)