The readv() call reads data on a socket with descriptor s and stores it in a set of buffers. The readv() call applies to connected sockets only.
#include <manifest.h>
#include <socket.h>
#include <bsdtypes.h>
#include <uio.h>
int readv(int s, struc iovec *iov, int iovcnt)
This call returns up to len bytes of data. If less than the number of bytes requested is available, the call returns the number currently available. If data is not available for the socket s, and s is in blocking mode, the readv() call blocks the caller until data arrives. If data is not available and s is in nonblocking mode, readv() returns a -1 and sets errno to EWOULDBLOCK. See fcntl() or ioctl() for a description of how to set nonblocking mode. When a datagram packet is too long to fit in the supplied buffer, datagram sockets discard extra bytes. Stream sockets act like streams of information with no boundaries separating data. For example, if applications A and B are connected with a stream socket and Application A sends 1000 bytes, each call to this function can return 1 byte, or 10 bytes, or the entire 1000 bytes. Therefore, applications using stream sockets should place this call in a loop and call this function until all data has been received.
connect(), fcntl(), getsockopt(), ioctl(), read(), recv(), recvmsg(), recvfrom(), select(), selectex(), send(), sendmsg(), sendto(), setsockopt(), socket(), write(), writev()