User`s guide

KwikNet TCP/IP Sockets
K
A
DAK
205
kn_readv kn_readv
Purpose Receive Scattered 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_readv(int s, struct iovec *iovecp, int iovcnt);
Description S is a socket descriptor identifying the socket from which data is to be
received. The socket must be connected.
Iovecp is a pointer to an array of data vectors describing the locations of
storage buffers for the received data. Each data vector is an iovec
structure which is described in file KN_SOCK.H as follows:
struct iovec {
void *iov_base; /* Data pointer */
int iov_len; /* Length of data */
};
Iov_base
is a pointer to storage for the received data.
Iov_len is the data buffer size, measured in bytes.
Iovcnt is an integer defining the number of data vectors (iovec
structures) which are provided in the array referenced by parameter
iovecp.
Returns If successful, the total number of bytes of data received is returned.
If the socket is closed by the sender, the value 0 is returned.
The array of iovec structures at *iovecp is unaltered.
Since the data vectors are unaltered, you can use them after the call to
examine the received data.
On failure, the error status -1 is returned.
...more