Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1 KiB

  1. .TH socket_recv6 3
  2. .SH NAME
  3. socket_recv6 \- receive a UDP datagram
  5. .B #include <socket.h>
  6. int \fBsocket_recv6\fP(int \fIs\fR, char* \fIbuf\fR, unsigned int \fIlen\fR,
  7. char \fIip\fR[16], uint16* \fIport\fR, uint32* \fIscope_id\fR);
  9. socket_recv6 receives up to \fIlen\fR bytes starting at \fIbuf\fR from a UDP
  10. datagram coming in on the socket \fIs\fR. It writes the UDP port to
  11. \fIport\fR and the IP address to \fIip\fR, and returns the number of
  12. bytes actually received (or -1 if anything went wrong).
  13. For link-local addresses, \fIscope_id\fR will become the network
  14. interface number, which can be translated into the name of the interface
  15. ("eth0") with socket_getifname.
  17. socket_recv6 returns the number of bytes in the datagram if one was
  18. received. If not, it returns -1 and sets errno appropriately.
  20. #include <socket.h>
  21. int \fIs\fR;
  22. char \fIip\fR[16];
  23. uint16 \fIp\fR;
  24. char buf[1000];
  25. int len;
  26. uint32 scope_id;
  27. \fIs\fR = socket_tcp();
  28. socket_bind6(s,ip,p);
  29. len = socket_recv6(s,buf,sizeof(buf),ip,&p,&scope_id);
  30. .SH "SEE ALSO"
  31. socket_recv6(3), socket_getifname(3)