The recv(), and recvfrom() functions receive a message from a socket. You can use the recv() call only on a connected socket, while recvfrom() can receive data on a socket whether it is in a connected state or not.
int recv( int s, char* buf, int len, int flags ); int recvfrom( int s, char* buf, int len, int flags, struct sockaddr* from, int* fromlen );
s
buf
len
buf
.
flags
0 |
No special handling. |
from
from
is non-zero, the source address of the message is filled in.
fromlen
If a message is too long to fit in the supplied buffer, excess bytes may be discarded depending on the type of socket the message is received from. If no messages are available at the socket, the receive call waits for a message to arrive, unless the socket is non-blocking, in which case -1 is returned.
-1
and the function sets errno to one of these values:
EBADF |
Invalid file descriptor or file not opened for writing. |
ENOSPC |
No space left on device. |
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/sys/socket.h | sys/types.h sys/socket.h |
netiff3m.lib |