PR_Writev
Writes data to a socket from multiple buffers.
Syntax
#include <prio.h>
PRInt32 PR_Writev(
  PRFileDesc *fd,
  PRIOVec *iov,
  PRInt32 size,
  PRIntervalTime timeout);
#define PR_MAX_IOVECTOR_SIZE 16
Parameters
The function has the following parameters:
fdA pointer to a PRFileDesc object for a socket.
iovAn array of
PRIOVecstructures that describe the buffers to write from.sizeNumber of
PRIOVecstructures in theiovarray. The value of this parameter must not be greater thanPR_MAX_IOVECTOR_SIZE. If it is, the function will fail and the error will be set toPR_BUFFER_OVERFLOW_ERROR.timeoutA value of type PRIntervalTime describing the time limit for completion of the entire write operation.
Returns
One of the following values:
A positive number indicates the number of bytes successfully written.
The value -1 indicates that the operation failed. The reason for the failure can be obtained by calling PR_GetError.
Description
The thread calling PR_Writev blocks until all the data is written or
the write operation fails. Therefore, the return value is equal to
either the sum of all the buffer lengths (on success) or -1 (on
failure). Note that if PR_Writev returns -1, part of the data may
have been written before an error occurred. If the timeout parameter is
not PR_INTERVAL_NO_TIMEOUT and all the data cannot be written in the
specified interval, PR_Writev returns -1 with the error code
PR_IO_TIMEOUT_ERROR.
This is the type definition for PRIOVec:
typedef struct PRIOVec {
  char *iov_base;
  int iov_len;
} PRIOVec;
The PRIOVec structure has the following fields:
iov_baseA pointer to the beginning of the buffer.
iov_lenThe size of the buffer.