NAME

zkSockWrite - write on a file

SYNOPSIS

#include "zkSysSocket.h"

ssize_t zkSockWrite(int socket, const void *buf, size_t nbyte);

DESCRIPTION

The zkSockWrite() function attempts to write nbyte bytes from the buffer pointed to by buf to the socket associated with the open socket descriptor, socket.

If nbyte is 0, zkSockWrite() will return 0 and have no other results.

If zkSockWrite() is interrupted by a signal before it writes any data, it will return -1 with errno set to [EINTR].

If zkSockWrite() is interrupted by a signal after it successfully writes some data, it will return the number of bytes written.

If the value of nbyte is greater than {SSIZE_MAX}, the result is implementation-dependent.

zkSockWrite() is equivalent to zkSend() with no flags set:

RETURN VALUE

Upon successful completion, zkSockWrite() will return the number of bytes actually written to the socket associated with socket. This number will never be greater than nbyte. Otherwise, -1 is returned and errno is set to indicate the error.

ERRORS

The zkSockWrite() function will fail if:

[EAGAIN]
The O_NONBLOCK flag is set for the file descriptor and the thread would be delayed in the zkSockWrite() operation.
[EBADF]
The socket argument is not a valid file descriptor open for writing.
[EFBIG]
An attempt was made to write a file that exceeds the implementation-dependent maximum file size  or the process' file size limit.
[EFBIG]
The file is a regular file, nbyte is greater than 0 and the starting position is greater than or equal to the offset maximum established in the open file description associated with socket.
[EINTR]
The write operation was terminated due to the receipt of a signal, and no data was transferred.
[EIO]
A physical I/O error has occurred.
[EIO]
The process is a member of a background process group attempting to write to its controlling terminal, TOSTOP is set, the process is neither ignoring nor blocking SIGTTOU and the process group of the process is orphaned. This error may also be returned under implementation-dependent conditions.
[ENOSPC]
There was no free space remaining on the device containing the file.
[EPIPE]
An attempt is made to write to a pipe or FIFO that is not open for reading by any process, or that only has one end open. A SIGPIPE signal will also be sent to the thread.
[ERANGE]
The transfer request size was outside the range supported by the STREAMS file associated with socket.

The zkSockWrite() function may fail if:

[EINVAL]
The STREAM or multiplexer referenced by socket is linked (directly or indirectly) downstream from a multiplexer.
[ENXIO]
A request was made of a non-existent device, or the request was outside the capabilities of the device.
[ENXIO]
A hangup occurred on the STREAM being written to.

PORTABILITY

The zkSockWrite() function may portably be used only with descriptors representing sockets. Any attempt to use it on a file, directory, FIFO, STREAMS file, terminal device file, character special file, or block special file is non-portable.