INtime SDK Help
recv, recvfrom (legacy networking)
INtime Help

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
);

Parameters

s
The socket to receive the message from.
buf
A pointer to a buffer where the received message will be placed.
len
The length in bytes of the buffer indicated by buf.
flags
You may set flags to one of these:
0 No special handling.
from
If from is non-zero, the source address of the message is filled in.
fromlen
Initialize to the size of the buffer associated with from. fromlen is modified on return to indicate the actual size of the address stored there.

Remarks

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.

Return Values

The number of bytes received in the message.
Success.
-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.
Failure.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/sys/socket.h sys/types.h
sys/socket.h
netiff3m.lib
See Also