User`s guide

KwikNet TCP/IP Sockets
K
A
DAK
209
kn_recvfrom kn_recvfrom
Purpose Receive Data from a Socket
Used by
n Task o ISP o Timer Procedure o Restart Procedure o Exit Procedure
Setup Prototype is in file KN_SOCK.H.
#include "KN_SOCK.H"
int kn_recvfrom(int s, void *buf, int len, int flags,
struct sockaddr *from, int *fromlen);
Description S is a socket descriptor identifying the socket from which data is to be
received. The socket can be connected or unconnected.
Buf is a pointer to storage for the received data.
Len is the buffer size, measured in bytes.
Flags is a control variable used to modify the receive process. Flags is 0
or the logical OR of any of the following values.
MSG_PEEK Peek at the received data but do not remove the data
from the socket.
MSG_DONTWAIT Receive in non-blocking fashion.
From is a pointer to storage for the address of the source of the received
data. The format of the IP address in structure sockaddr is described
in header file KN_SOCK.H.
The purpose of this parameter is to allow the sender to be identified
when using a connectionless socket such as that used for UDP
datagrams on a socket of type SOCK_DGRAM. The format of the address
is suitable for sending a response using procedure
kn_sendto(). Set
from to NULL if the address of the message sender is not required.
Fromlen is a pointer to storage for the length of the sender's address. On
entry, the integer at
*fromlen must define the maximum storage
available within the structure referenced by from.
...more