netwrite3
Send a message on a socket
Usage
#include "net.h"
int netwrite (int s, char *buf, int nbytes);
ssize_t netwrite_timeout (int s, void *buf, size_t nbytes, int timeout);
Overview
netwrite sends a message on a socket.
Return value
This routine returns the number of bytes if the operation was successful, 0 if the connection was closed by the remote end or -1 if the operation failed. In the latter case, serrno is set appropriately.
Errors
- EINTR
-
The function was interrupted by a signal.
- EBADF
-
s is not a valid descriptor.
- EAGAIN
-
The socket is non-blocking and there is no space available in the system buffers for the message.
- EFAULT
-
buf is not a valid pointer.
- EINVAL
-
nbytes is negative or zero.
- ENOTSOCK
-
s is not a socket.
- SECONNDROP
-
Connection closed by remote end.
- SETIMEDOUT
-
Timed out.
Releases
Unchanged in 5 releases since Debian 6.0 (Squeeze).