Chapter Contents |
Previous |
Next |
writev |
Portability: | UNIX compatible |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
PORTABILITY | |
RELATED FUNCTIONS |
SYNOPSIS |
#include <sys/types.h> #include <sys/uio.h> #include <fcntl.h> int writev(int s, struct iovec *iov, int iovcnt);
DESCRIPTION |
writev
writes data to connected socket descriptor
s
from the
iovcnt
buffers specified by the
iov
array. As with the
write
call, the socket must
have been previously associated with a
remote address via the
connect
system call. If there are no data,
writev
blocks the caller unless the socket is in non-blocking mode.
The
iovec
structure is
defined in the
<sys/uio.h>
header file. Each
iovec
entry specifies the base address and length of an area in memory from
which the data should be taken.
writev
completely sends one area before proceeding to the next area.
writev
is an atomic operation. For datagram sockets, each
writev
call causes one datagram to be sent.
Note:
Although
writev
is primarily used with sockets, it can also be used to write
any file that can be accessed by the
write
function.
RETURN VALUE |
If
writev
succeeds, it returns the number of bytes written. If
writev
returns a
0
, the end-of-file has been reached. If
writev
fails, it returns
a
-1
.
PORTABILITY |
writev
is portable to other environments, including most UNIX systems,
that implement BSD sockets.
RELATED FUNCTIONS |
connect
,
recv
,
recvfrom
,
recvmsg
,
read
,
readv
,
write
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.