HP Rp3440-4 - 9000 - 0 MB RAM Programmer's Manual page 157

Bsd sockets interface programmer’s guide
Hide thumbs Also See for Rp3440-4 - 9000 - 0 MB RAM:
Table of Contents

Advertisement

Parameter
Contents
s
socket
descriptor of
local socket
msg
pointer to data
buffer
len
maximum
number of
bytes that
should be
received
flags
settings for
optional flags
from
address of
socket that
sent message
fromlen
pointer to the
size of from
Function result: number of bytes actually received if recvfrom succeeds,
-1 if recvfrom call fails.
Example:
struct
int
...
count = recvfrom(s, msg, sizeof(msg), 0,
&fromaddr, &fromlen);
recvfrom blocks until there is a message to be received.
No more than len bytes of data are returned. The entire message is read
in one recvfrom, recvmsg, recv, or read operation. If the message is
too long for the receive buffer, the excess data are discarded. Because
only one message can be returned in a recvfrom call, if a second
Chapter 7
Using UNIX Domain Datagram Sockets
Sending and Receiving Messages
INPUT Value
socket descriptor
of socket receiving
the message
pointer to buffer
that is to receive
data
size of data buffer
0 (no options are
supported
pointer to address
structure, not used
for input
pointer to size of
from
sockaddr_un
fromaddr;
fromlen;
OUTPUT
Value
unchanged
pointer to
received data
unchanged
unchanged
pointer to
socket address
of socket that
sent the
message
pointer to the
actual size of
address
returned
157

Advertisement

Table of Contents
loading

Table of Contents