Syntax
#include <sys/types.h>
#include <sys/socket.h>
int recvfrom(int socket_descriptor,
char *buffer,
int buffer_length,
int flags,
struct sockaddr *from_address,
int *address_length)
|
The recvfrom() function is used to receive data through a connected or unconnected socket.
Parameters
The structure sockaddr is defined in <sys/socket.h>.
struct sockaddr {
u_short sa_family;
char sa_data[14];
};
The sa_family field identifies the address family to which the address belongs, and sa_data is the address whose format is dependent on the address family.
Return Value
recvfrom() returns an integer. Possible values are:
Error Conditions
When recvfrom() fails, errno can be set to one of the following:
The socket pointed to by the socket_descriptor parameter is using a connection-oriented transport service, and a connect() was previously completed. The process, however, does not have the appropriate privileges to the objects that were needed to establish a connection. For example, the connect() required the use of an APPC device that the process was not authorized to.
This error code indicates that the transport provider ended the connection abnormally because of one of the following:
The system detected an address which was not valid while attempting to access the buffer, from_address, or address_length parameter.
This error code indicates one of the following:
This error code is returned only on sockets that use a connection-oriented transport service.
This error code indicates one of the following:
A non-blocking connect() was previously issued that resulted in the connection establishment timing out. No connection is established. This error code is returned only on sockets that use a connection-oriented transport service.
Error Messages
Usage Notes
Related Information
| Top | Sockets APIs | APIs by category |
| [Information Center Home Page | Feedback ] | [Legal | AS/400 Glossary] |