op_recvfrom()
Note: Requires Shared Code functionality
Abstract
Receives a message from a specified socket.
Syntax
op_recvfrom (sockfd, buf, len, flags, src_addr, addrlen)
| Argument | Type | Description |
|---|---|---|
sockfd |
int |
File descriptor of the receiving socket |
buf |
void * |
Buffer to hold the received message |
len |
size_t |
Size of buf, in bytes |
flags |
int |
not used (pass as 0) |
src_addr |
const struct sockaddr * |
Pointer to a structure containing the sender address |
addrlen |
unsigned int * |
Size of the src_addr structure |
Return Type
int
Number of bytes received; -1 if unsuccessful.
Header
shared_code_support.h
Details
If no message is available to be read, the process will suspend and wait for a message to be available (blocking mode only). In non-blocking mode, no message available returns -1 and sets errno to EWOULDBLOCK.