nn::socket::RecvFrom Function
s32 RecvFrom(
s32 s,
void * buf,
s32 len,
s32 flags,
SockAddrIn * sockFrom
);
| Name | Description | |
|---|---|---|
| in | s | Specifies a socket descriptor. Specifies a socket descriptor created using the Socket or Accept function. |
| in | buf | Specifies a pointer to the buffer used to read out received data. |
| in | len | Specifies the size in bytes of the buffer used to read out received data. |
| in | flags | Specifies the message transmission type. |
| out | sockFrom | Specifies a pointer to the socket address structure used to get the communication target's address information. The len field of the socket address must be initialized appropriately (for example, to sizeof(SockAddrIn)). |
| Value | Description |
|---|---|
| 0 | For stream sockets (SOCK_STREAM), this indicates that the socket cannot accept any more messages because the remote host has finished sending messages. For datagram sockets (SOCK_DGRAM), this function does not return 0. |
| 1 | A return value of one or more indicates the number of bytes of received messages. |
ENETRESET |
Socket library is not initialized. |
EBADF |
Invalid socket descriptor. |
EAGAIN |
There is no data or out-of-band data waiting to be received, even when O_NONBLOCK is set in the socket descriptor (or when the MSG_DONTWAIT flag is set). |
EINVAL |
Invalid processing. |
EOPNOTSUPP |
Process not supported. |
ENOTCONN |
Not connected. |
ECONNRESET |
The connection was reset. |
EINTR |
Suspended. |
ETIMEDOUT |
Timeout. |
ENETDOWN |
The local network interface is down. |
Attempts to receive data (messages) from a remote host via a socket.
This function usually blocks until the socket receives a message. However, if the Fcntl function has set the socket to non-blocking mode and flags is set to MSG_DONTWAIT, this function does not block and only gets the data already received at the time this function is called. For datagram sockets (SOCK_DGRAM), the entire message is read out in a single operation. If the message cannot fit into the allocated buffer and flags is not set to MSG_PEEK, any data that does not fit into the buffer is discarded. For stream sockets (SOCK_STREAM), message boundaries are ignored. In this case, data is returned to the user as it becomes usable.
CONFIDENTIAL