|const struct iovec * iov,|
writev() functions as a scatter write because the written data can be placed in multiple buffers. writev() attempts to write data to the socket socketDescriptor by gathering the data from into the iovcnt buffers specified by the members of the iov array: iov, iov, ..., iov[iovcnt-1].
The iovec structure contains the following members:
caddr_t iov_base; int iov_len;
Each iovec entry specifies the base address and length of an area in memory from where data should be gathered. writev() always reads one buffer completely before proceeding to the next. On success, writev() return the number of bytes actually written; this number may be less than the total of all of the iov_len values if there is not enough space on the send queues.
- The socket descriptor to write data to.
- The list of buffers to gather and send the data from.
- The number of buffers in the list.
- > 0
- Number of bytes actually written.
|Note:|| TM_SOCKET_ERROR means that this socket call has failed and the errorCode has been set on the socket itself.
To retrieve the socket error the user must call tfGetSocketError(socketDescriptor).
Possible socket errors
- The socket descriptor is invalid.
- One of the following:
- iovcnt is 0 or less than zero.
- The sum of iov_len values overflowed an integer.
- Insufficient memory to complete the operation.
- No route to destination. (For non-TCP sockets.)
- The socket received an ICMP destination unreachable message from the remote host. This typically means that the receiver is not listening on the remote port. (For non-TCP sockets.)
- The socket requires the message to be sent atomically, and the message was too long.
- The socket is marked as non-blocking and all of the data could not be written.
- The socket is not connected.