Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
recvfrom(2) OSS System Calls Reference Manual
For message-based sockets (sockets of type SOCK_DGRAM), the entire message must be read
in one call. If a message is too long to fit in the supplied buffer and MSG_PEEK is not set in the
flags parameter, the excess bytes are discarded.
For stream-based sockets (sockets of type SOCK_STREAM), message boundaries are ignored.
For such sockets, data is returned as soon as it becomes available; no data is discarded.
If no messages are available at the socket and the socket’s file descriptor is blocking
(O_NONBLOCK is not set), the recvfrom() function blocks until a message arrives. If no mes-
sages are available at the socket and the socket’s file descriptor is marked nonblocking
(O_NONBLOCK is set), the recvfrom() function fails and sets errno to [EWOULDBLOCK].
If the address parameter is not a null pointer, the source address of the received message is stored
in the sockaddr structure pointed to by the address parameter, and the length of this address is
stored in the object pointed to by the address_len parameter.
If the actual length of the address is greater than the length of the supplied sockaddr structure,
the address is truncated when stored.
To pass a 32-bit pointer from a 32-bit Guardian or OSS client, recvfrom() or recvfrom64_()
may be called.
To pass a 64-bit pointer from a 32-bit Guardian or OSS client, recvfrom64_() must be called.
32-bit Guardian and 64-bit OSS clients can pass 32-bit pointers and 64-bit pointers to
recvfrom64_().
NOTES
This function requires that the feature-test macro _XOPEN_SOURCE_EXTENDED be specified
when you compile the module.
When data is available, a call to the select() function indicates that the file descriptor for the
socket is ready for reading.
For AF_UNIX Release 1 sockets and for AF_UNIX Release 2 sockets in compatibility mode,
when the file to which a sending datagram socket is bound is ulinked or renamed, and one of the
send set of functions is called, the receiving client’s call to recvfrom() returns a null address (all
fields in the address are zero).
For AF_UNIX Release 2 sockets in portability mode, when the file to which a sending datagram
socket is bound is unlinked or renamed, and one of the send set of functions is called, the receiv-
ing client’s call to recvfrom() returns the fully-qualified form of the address to which the send-
ing socket was originally bound.
For more information about AF_UNIX Release 2 sockets, portability mode, and compatibility
mode, see the Open System Services Programmer’s Guide.
To use the recvfrom() functionality in a threaded application that uses the Standard POSIX
Threads library, see spt_recvfromx(2).
To use this function in a threaded application that uses the POSIX User Thread Model library on
systems running J06.10 or later RVUs or H06.21 or later RVUs, you must perform all of the fol-
lowing tasks to make the function thread-aware in a multi-threaded application:
• Compile the application using the _PUT_MODEL_ feature test macro or equivalent
compiler command option.
• Link the application to the zputdll library (/G/system/zdllnnn/zputdll).
On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can use
this function with 32-bit or 64-bit OSS applications.
6−28 Hewlett-Packard Company 527186-023