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.
 
 
 
 

32 lines
916 B

  1. .TH socket_recv4 3
  2. .SH NAME
  3. socket_recv4 \- receive a UDP datagram
  4. .SH SYNTAX
  5. .B #include <socket.h>
  6. int \fBsocket_recv4\fP(int \fIs\fR, char* \fIbuf\fR, unsigned int \fIlen\fR,
  7. char \fIip\fR[4],uint16* \fIport\fR);
  8. .SH DESCRIPTION
  9. socket_recv4 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. .SH RETURN VALUE
  14. socket_recv4 returns the number of bytes in the datagram if one was
  15. received. If not, it returns -1 and sets errno appropriately.
  16. .SH EXAMPLE
  17. #include <socket.h>
  18. int \fIs\fR;
  19. char \fIip\fR[4];
  20. uint16 \fIp\fR;
  21. char buf[1000];
  22. int len;
  23. \fIs\fR = socket_tcp();
  24. socket_bind4(s,ip,p);
  25. len = socket_recv4(s,buf,sizeof(buf),ip,&p);
  26. .SH "SEE ALSO"
  27. socket_recv6(3)