VMS Help
TCPIP Services, Programming Interfaces, Sockets API, write()
*Conan The Librarian (sorry for the slow response - running on an old VAX)
|
|
Writes bytes from a buffer to a file or socket.
The $QIO equivalent is the IO$_WRITEVBLK function.
Format
#include <unixio.h>
int write ( int d, void *buffer, int nbytes );
d
A descriptor that refers to a socket or file.
buffer
The address of a buffer from which the output data is to be
taken.
nbytes
The maximum number of bytes involved in the write operation.
This function attempts to write a buffer of data to a socket or
file.
Related Functions
See also socket().
x The number of bytes written to the socket or
file.
-1 Error; errno is set to indicate the error.
EPIPE The socket is shut down for writing or is
connection oriented, and the peer is closed or
shut down for reading. In the latter case, if
the socket is of type SOCK_STREAM, the SIGPIPE
signal is generated to the calling process.
EWOULDBLOCK The NBIO (nonblocking) flag is set for the
socket descriptor, and the process is delayed
during the write operation.
EINVAL The nbytes argument is a negative value.
EAGAIN The O_NONBLOCK flag is set on this file, and
the process is delayed in the write operation.
EBADF The d argument does not specify a valid file
descriptor that is open for writing.
EINTR A write() or pwrite() function on a pipe is
interrupted by a signal, and no bytes have
been transferred through the pipe.
EINVAL On of the following errors occurred:
o The STREAM or multiplexer referenced
by d is linked (directly or indirectly)
downstream from a multiplexer.
o The iov_count argument value was less than
or equal to zero or greater than IOV_MAX.
o The sum of the iov_len values in the iov
array overflows a ssize_t data type.
o The file position pointer associated with
the d argument was a negative value.
o One of the iov_len values in the iov array
was negative, or the sum overflowed a 32-
bit integer.
EPERM An attempt was made to write to a socket of
type SOCK_STREAM that is not connected to a
peer socket.
EPIPE An attempt was made to write to a pipe that
has only one end open.
An attempt was made to write to a pipe or FIFO
that is not opened for reading by any process.
A SIGPIPE signal is sent to the process.
ERANGE An attempt was made to write to a STREAM
socket where nbytes are outside the specified
minimum and maximum range, and the minimum
value is nonzero.
[legal]
[privacy]
[GNU]
[policy]
[netiquette]
[sponsors]
[FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.