IPX/SPX Programming Manual

Library Routines
HP NonStop IPX/SPX Programming Manual528022-001
5-36
recvfrom
flags
specifies how the message is read, and is one of the following messages:
from_ptr
points, on return, to the IPX address data structure from which the data is received.
from_length
is maintained only for compatibility and should point to a value indicating the size in
bytes of the remote IPX address data structure pointed to by from_ptr.
Errors
If an error occurs, the return value is set to -1 and the external variable errno is set to
one of the following values:
Usage Guidelines
This is a waited call; your program will pause until the operation completes. On
rare occasions, this call can halt program execution; refer to “Usage Guidelines” in
the recv function description for more information.
Example
In the following programming example, the recvfrom function is called to receive the
address of the host from which the rsock data is received, where rsock is a socket
that was created by a previous call to socket and fhost is a structure that receives
the address of the host from which the data is received. The data is received in
buffer.
#include <socket.h>
#include <nv.h>
#include <netdb.h>
...
struct sockaddr_nv fhost;
int status, tosend, len;
char buffer[8*1024];
...
tosend = sizeof(buffer);
status = recvfrom(rsock, buffer, tosend,
0,(struct sockaddr *)&fhost, &len);
MSG_PEEK Read the incoming message without removing it
from the queue.
0 No flag; read incoming message normally.
EISCONN The specified socket was connected.
ESHUTDOWN The specified socket was shut down.
EINVAL An invalid argument was specified.