2 .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved. Portions Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 .\" http://www.opengroup.org/bookstore/.
5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions 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.
6 .\" This notice shall appear on any product containing this material.
7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 .TH SEND 3XNET "Dec 3, 2014"
12 send \- send a message on a socket
16 \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lxnet\fR [ \fIlibrary\fR ... ]
17 #include <sys/socket.h>
19 \fBssize_t\fR \fBsend\fR(\fBint\fR \fIsocket\fR, \fBconst void *\fR\fIbuffer\fR, \fBsize_t\fR \fIlength\fR, \fBint flags\fR);
28 Specifies the socket file descriptor.
37 Points to the buffer containing the message to send.
46 Specifies the length of the message in bytes.
55 Specifies the type of message transmission. Values of this argument are formed
56 by logically OR'ing zero or more of the following flags:
63 Terminates a record (if supported by the protocol)
72 Sends out-of-band data on sockets that support out-of-band communications. The
73 significance and semantics of out-of-band data are protocol-specific.
80 The \fBsend()\fR function initiates transmission of a message from the
81 specified socket to its peer. The \fBsend()\fR function sends a message only
82 when the socket is connected (including when the peer of a connectionless
83 socket has been set via \fBconnect\fR(3XNET)).
86 The length of the message to be sent is specified by the \fIlength\fR argument.
87 If the message is too long to pass through the underlying protocol,
88 \fBsend()\fR fails and no data is transmitted.
91 Successful completion of a call to \fBsend()\fR does not guarantee delivery of
92 the message. A return value of \(mi1 indicates only locally-detected errors.
95 If space is not available at the sending socket to hold the message to be
96 transmitted and the socket file descriptor does not have \fBO_NONBLOCK\fR set,
97 \fBsend()\fR blocks until space is available. If space is not available at the
98 sending socket to hold the message to be transmitted and the socket file
99 descriptor does have \fBO_NONBLOCK\fR set, \fBsend()\fR will fail. The
100 \fBselect\fR(3C) and \fBpoll\fR(2) functions can be used to determine when it
101 is possible to send more data.
104 The socket in use may require the process to have appropriate privileges to use
105 the \fBsend()\fR function.
108 The \fBsend()\fR function is identical to \fBsendto\fR(3XNET) with a null
109 pointer \fIdest_len\fR argument, and to \fBwrite()\fR if no flags are used.
112 Upon successful completion, \fBsend()\fR returns the number of bytes sent.
113 Otherwise, \(mi1 is returned and \fBerrno\fR is set to indicate the error.
116 The \fBsend()\fR function will fail if:
124 \fB\fBEWOULDBLOCK\fR\fR
127 The socket's file descriptor is marked \fBO_NONBLOCK\fR and the requested
128 operation would block.
137 The \fIsocket\fR argument is not a valid file descriptor.
143 \fB\fBECONNRESET\fR\fR
146 The \fIsocket\fR argument refers to a connection oriented socket and the
147 connection was forcibly closed by the peer and is no longer valid. I/O can no
148 longer be performed to \fIfiledes\fR.
154 \fB\fBEDESTADDRREQ\fR\fR
157 The socket is not connection-mode and no peer address is set.
166 The \fIbuffer\fR parameter can not be accessed.
175 A signal interrupted \fBsend()\fR before any data was transmitted.
184 The message is too large be sent all at once, as the socket requires.
193 The socket is not connected or otherwise has not had the peer prespecified.
202 The \fIsocket\fR argument does not refer to a socket.
208 \fB\fBEOPNOTSUPP\fR\fR
211 The \fIsocket\fR argument is associated with a socket that does not support one
212 or more of the values set in \fIflags\fR.
221 The socket is shut down for writing, or the socket is connection-mode and is no
222 longer connected. In the latter case, and if the socket is of type
223 \fBSOCK_STREAM\fR, the \fBSIGPIPE\fR signal is generated to the calling thread.
228 The \fBsend()\fR function may fail if:
235 The calling process does not have the appropriate privileges.
244 An I/O error occurred while reading from or writing to the file system.
253 The local interface used to reach the destination is down.
259 \fB\fBENETUNREACH\fR\fR
262 No route to the network is present.
271 Insufficient resources were available in the system to perform the operation.
280 There were insufficient STREAMS resources available for the operation to
286 See \fBattributes\fR(5) for descriptions of the following attributes:
294 ATTRIBUTE TYPE ATTRIBUTE VALUE
296 Interface Stability Standard
303 \fBconnect\fR(3XNET), \fBgetsockopt\fR(3XNET), \fBpoll\fR(2),
304 \fBrecv\fR(3XNET), \fBrecvfrom\fR(3XNET), \fBrecvmsg\fR(3XNET),
305 \fBselect\fR(3C), \fBsendmsg\fR(3XNET), \fBsendto\fR(3XNET),
306 \fBsetsockopt\fR(3XNET), \fBshutdown\fR(3XNET), \fBsocket\fR(3XNET),
307 \fBattributes\fR(5), \fBstandards\fR(5)