summaryrefslogtreecommitdiff
path: root/man3p/send.3p
diff options
context:
space:
mode:
Diffstat (limited to 'man3p/send.3p')
-rw-r--r--man3p/send.3p173
1 files changed, 173 insertions, 0 deletions
diff --git a/man3p/send.3p b/man3p/send.3p
new file mode 100644
index 000000000..c3bf82710
--- /dev/null
+++ b/man3p/send.3p
@@ -0,0 +1,173 @@
+.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
+.TH "SEND" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
+.\" send
+.SH NAME
+send \- send a message on a socket
+.SH SYNOPSIS
+.LP
+\fB#include <sys/socket.h>
+.br
+.sp
+ssize_t send(int\fP \fIsocket\fP\fB, const void *\fP\fIbuffer\fP\fB,
+size_t\fP \fIlength\fP\fB, int\fP
+\fIflags\fP\fB);
+.br
+\fP
+.SH DESCRIPTION
+.LP
+The \fIsend\fP() function shall initiate transmission of a message
+from the specified socket to its peer. The \fIsend\fP()
+function shall send a message only when the socket is connected (including
+when the peer of a connectionless socket has been set
+via \fIconnect\fP()).
+.LP
+The \fIsend\fP() function takes the following arguments:
+.TP 7
+\fIsocket\fP
+Specifies the socket file descriptor.
+.TP 7
+\fIbuffer\fP
+Points to the buffer containing the message to send.
+.TP 7
+\fIlength\fP
+Specifies the length of the message in bytes.
+.TP 7
+\fIflags\fP
+Specifies the type of message transmission. Values of this argument
+are formed by logically OR'ing zero or more of the
+following flags:
+.TP 7
+MSG_EOR
+.RS
+Terminates a record (if supported by the protocol).
+.RE
+.TP 7
+MSG_OOB
+.RS
+Sends out-of-band data on sockets that support out-of-band communications.
+The significance and semantics of out-of-band data
+are protocol-specific.
+.RE
+.sp
+.sp
+.LP
+The length of the message to be sent is specified by the \fIlength\fP
+argument. If the message is too long to pass through the
+underlying protocol, \fIsend\fP() shall fail and no data shall be
+transmitted.
+.LP
+Successful completion of a call to \fIsend\fP() does not guarantee
+delivery of the message. A return value of -1 indicates only
+locally-detected errors.
+.LP
+If space is not available at the sending socket to hold the message
+to be transmitted, and the socket file descriptor does not
+have O_NONBLOCK set, \fIsend\fP() shall block until space is available.
+If space is not available at the sending socket to hold
+the message to be transmitted, and the socket file descriptor does
+have O_NONBLOCK set, \fIsend\fP() shall fail. The \fIselect\fP() and
+\fIpoll\fP() functions can be used to
+determine when it is possible to send more data.
+.LP
+The socket in use may require the process to have appropriate privileges
+to use the \fIsend\fP() function.
+.SH RETURN VALUE
+.LP
+Upon successful completion, \fIsend\fP() shall return the number of
+bytes sent. Otherwise, -1 shall be returned and
+\fIerrno\fP set to indicate the error.
+.SH ERRORS
+.LP
+The \fIsend\fP() function shall fail if:
+.TP 7
+.B EAGAIN \fRor\fP EWOULDBLOCK
+.sp
+The socket's file descriptor is marked O_NONBLOCK and the requested
+operation would block.
+.TP 7
+.B EBADF
+The \fIsocket\fP argument is not a valid file descriptor.
+.TP 7
+.B ECONNRESET
+A connection was forcibly closed by a peer.
+.TP 7
+.B EDESTADDRREQ
+.sp
+The socket is not connection-mode and no peer address is set.
+.TP 7
+.B EINTR
+A signal interrupted \fIsend\fP() before any data was transmitted.
+.TP 7
+.B EMSGSIZE
+The message is too large to be sent all at once, as the socket requires.
+.TP 7
+.B ENOTCONN
+The socket is not connected or otherwise has not had the peer pre-specified.
+.TP 7
+.B ENOTSOCK
+The \fIsocket\fP argument does not refer to a socket.
+.TP 7
+.B EOPNOTSUPP
+The \fIsocket\fP argument is associated with a socket that does not
+support one or more of the values set in
+\fIflags\fP.
+.TP 7
+.B EPIPE
+The socket is shut down for writing, or the socket is connection-mode
+and is no longer connected. In the latter case, and if
+the socket is of type SOCK_STREAM, the SIGPIPE signal is generated
+to the calling thread.
+.sp
+.LP
+The \fIsend\fP() function may fail if:
+.TP 7
+.B EACCES
+The calling process does not have the appropriate privileges.
+.TP 7
+.B EIO
+An I/O error occurred while reading from or writing to the file system.
+.TP 7
+.B ENETDOWN
+The local network interface used to reach the destination is down.
+.TP 7
+.B ENETUNREACH
+.sp
+No route to the network is present.
+.TP 7
+.B ENOBUFS
+Insufficient resources were available in the system to perform the
+operation.
+.sp
+.LP
+\fIThe following sections are informative.\fP
+.SH EXAMPLES
+.LP
+None.
+.SH APPLICATION USAGE
+.LP
+The \fIsend\fP() function is equivalent to \fIsendto\fP() with a null
+pointer
+\fIdest_len\fP argument, and to \fIwrite\fP() if no flags are used.
+.SH RATIONALE
+.LP
+None.
+.SH FUTURE DIRECTIONS
+.LP
+None.
+.SH SEE ALSO
+.LP
+\fIconnect\fP() , \fIgetsockopt\fP() , \fIpoll\fP() , \fIrecv\fP()
+, \fIrecvfrom\fP() , \fIrecvmsg\fP() , \fIselect\fP() , \fIsendmsg\fP()
+, \fIsendto\fP() , \fIsetsockopt\fP() , \fIshutdown\fP() , \fIsocket\fP()
+, the Base Definitions volume of
+IEEE\ Std\ 1003.1-2001, \fI<sys/socket.h>\fP
+.SH COPYRIGHT
+Portions of this text are reprinted and reproduced in electronic form
+from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
+-- Portable Operating System Interface (POSIX), The Open Group Base
+Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
+Electrical and Electronics Engineers, Inc and The Open Group. In the
+event of any discrepancy between this version and the original IEEE and
+The Open Group Standard, the original IEEE and The Open Group Standard
+is the referee document. The original Standard can be obtained online at
+http://www.opengroup.org/unix/online.html .