Flag Options - HP Rp3440-4 - 9000 - 0 MB RAM Programmer's Manual

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

Advertisement

Using Internet Datagram Sockets
Sending and Receiving Messages
Parameter
Contents
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, –1 if an error
occurs.
Example:
addrlen = sizeof(sockaddr_in);
...
count = recvfrom(s, buffer, BUFFERSIZE, 0, clientaddr, &addrlen);
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 allocated buffer, the excess data are discarded. Because
only one message can be returned in a recvfrom call, if a second
message is in the queue, it is not affected. Therefore, the best technique
is to receive as much as possible on each call.
The host does not wait for len bytes to be available; if less than len
bytes are available, that number of bytes are returned.

Flag Options

The flag options are:
• 0 for no options.
98
INPUT Value
0 or MSG_PEEK
pointer to address
structure, not used
for input
pointer to size of
from
OUTPUT
Value
unchanged
pointer to
socket
address of
socket that
sent the
message
pointer to
the actual
size of
address
returned
Chapter 4

Advertisement

Table of Contents
loading

Table of Contents