nn::socket::RecvFrom Function
s32 RecvFrom(
s32 s,
void * buf,
s32 len,
s32 flags,
SockAddrIn * sockFrom
);
| Name | Description | |
|---|---|---|
| in | s | Specifies a socket descriptor. Specify 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)). |
SOCK_STREAM), this function returns 0 to indicate 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. 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, the data is returned to the user application as soon as the data becomes usable.
A return value of one or more indicates the number of bytes of received messages.
CONFIDENTIAL