File: socket_recv4.3

package info (click to toggle)
libowfat 0.22-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,148 kB
  • ctags: 976
  • sloc: ansic: 10,424; makefile: 42
file content (31 lines) | stat: -rw-r--r-- 917 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
.TH socket_recv4 3
.SH NAME
socket_recv4 \- receive a UDP datagram
.SH SYNTAX
.B #include <socket.h>

int \fBsocket_recv4\fP(int \fIs\fR, char* \fIbuf\fR, unsigned int \fIlen\fR,
                 char \fIip\fR[4],uint16* \fIport\fR);
.SH DESCRIPTION
socket_recv4 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).
.SH RETURN VALUE
socket_recv4 returns the number of bytes in the datagram if one was
received.  If not, it returns -1 and sets errno appropriately.
.SH EXAMPLE
  #include <socket.h>

  int \fIs\fR;
  char \fIip\fR[4];
  uint16 \fIp\fR;
  char buf[1000];
  int len;

  \fIs\fR = socket_tcp4();
  socket_bind4(s,ip,p);
  len = socket_recv4(s,buf,sizeof(buf),ip,&p);

.SH "SEE ALSO"
socket_recv6(3)