]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - doc/html/ref/net-common-tcpip-manpages-send.html
Initial revision
[karo-tx-redboot.git] / doc / html / ref / net-common-tcpip-manpages-send.html
1 <!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2 <!-- This material may be distributed only subject to the terms      -->
3 <!-- and conditions set forth in the Open Publication License, v1.0  -->
4 <!-- or later (the latest version is presently available at          -->
5 <!-- http://www.opencontent.org/openpub/).                           -->
6 <!-- Distribution of the work or derivative of the work in any       -->
7 <!-- standard (paper) book form is prohibited unless prior           -->
8 <!-- permission is obtained from the copyright holder.               -->
9 <HTML
10 ><HEAD
11 ><TITLE
12 >send</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
14 <META
15 NAME="GENERATOR"
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17 "><LINK
18 REL="HOME"
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
21 REL="UP"
22 TITLE="TCP/IP Library Reference"
23 HREF="tcpip-library-reference.html"><LINK
24 REL="PREVIOUS"
25 TITLE="select"
26 HREF="net-common-tcpip-manpages-select.html"><LINK
27 REL="NEXT"
28 TITLE="shutdown"
29 HREF="net-common-tcpip-manpages-shutdown.html"></HEAD
30 ><BODY
31 CLASS="SECT1"
32 BGCOLOR="#FFFFFF"
33 TEXT="#000000"
34 LINK="#0000FF"
35 VLINK="#840084"
36 ALINK="#0000FF"
37 ><DIV
38 CLASS="NAVHEADER"
39 ><TABLE
40 SUMMARY="Header navigation table"
41 WIDTH="100%"
42 BORDER="0"
43 CELLPADDING="0"
44 CELLSPACING="0"
45 ><TR
46 ><TH
47 COLSPAN="3"
48 ALIGN="center"
49 >eCos Reference Manual</TH
50 ></TR
51 ><TR
52 ><TD
53 WIDTH="10%"
54 ALIGN="left"
55 VALIGN="bottom"
56 ><A
57 HREF="net-common-tcpip-manpages-select.html"
58 ACCESSKEY="P"
59 >Prev</A
60 ></TD
61 ><TD
62 WIDTH="80%"
63 ALIGN="center"
64 VALIGN="bottom"
65 >Chapter 38. TCP/IP Library Reference</TD
66 ><TD
67 WIDTH="10%"
68 ALIGN="right"
69 VALIGN="bottom"
70 ><A
71 HREF="net-common-tcpip-manpages-shutdown.html"
72 ACCESSKEY="N"
73 >Next</A
74 ></TD
75 ></TR
76 ></TABLE
77 ><HR
78 ALIGN="LEFT"
79 WIDTH="100%"></DIV
80 ><DIV
81 CLASS="SECT1"
82 ><H1
83 CLASS="SECT1"
84 ><A
85 NAME="NET-COMMON-TCPIP-MANPAGES-SEND">send</H1
86 ><TABLE
87 BORDER="5"
88 BGCOLOR="#E0E0F0"
89 WIDTH="70%"
90 ><TR
91 ><TD
92 ><PRE
93 CLASS="SCREEN"
94 >SEND(2)                       System Calls Manual                      SEND(2)
95
96 NAME
97      send, sendto, sendmsg - send a message from a socket
98
99 SYNOPSIS
100      #include &lt;sys/types.h&#62;
101      #include &lt;sys/socket.h&#62;
102
103      ssize_t
104      send(int s, const void *msg, size_t len, int flags);
105
106      ssize_t
107      sendto(int s, const void *msg, size_t len, int flags,
108              const struct sockaddr *to, socklen_t tolen);
109
110      ssize_t
111      sendmsg(int s, const struct msghdr *msg, int flags);
112
113 DESCRIPTION
114      send(), sendto(), and sendmsg() are used to transmit a message to another
115      socket.  send() may be used only when the socket is in a connected state,
116      while sendto() and sendmsg() may be used at any time.
117
118      The address of the target is given by to with tolen specifying its size.
119      The length of the message is given by len.  If the message is too long to
120      pass atomically through the underlying protocol, the error EMSGSIZE is
121      returned, and the message is not transmitted.
122
123      No indication of failure to deliver is implicit in a send().  Locally
124      detected errors are indicated by a return value of -1.
125
126      If no messages space is available at the socket to hold the message to be
127      transmitted, then send() normally blocks, unless the socket has been
128      placed in non-blocking I/O mode.  The select(2) or poll(2) system calls
129      may be used to determine when it is possible to send more data.
130
131      The flags parameter may include one or more of the following:
132
133      #define MSG_OOB        0x1  /* process out-of-band data */
134      #define MSG_DONTROUTE  0x4  /* bypass routing, use direct interface */
135
136      The flag MSG_OOB is used to send ``out-of-band'' data on sockets that
137      support this notion (e.g., SOCK_STREAM); the underlying protocol must
138      also support ``out-of-band'' data.  MSG_DONTROUTE is usually used only by
139      diagnostic or routing programs.
140
141      See recv(2) for a description of the msghdr structure.
142
143 RETURN VALUES
144      The call returns the number of characters sent, or -1 if an error
145      occurred.
146
147 ERRORS
148      send(), sendto(), and sendmsg() fail if:
149
150      [EBADF]            An invalid descriptor was specified.
151
152      [ENOTSOCK]         The argument s is not a socket.
153
154      [EFAULT]           An invalid user space address was specified for a
155                         parameter.
156
157      [EMSGSIZE]         The socket requires that message be sent atomically,
158                         and the size of the message to be sent made this
159                         impossible.
160
161      [EAGAIN]           The socket is marked non-blocking and the requested
162                         operation would block.
163
164      [ENOBUFS]          The system was unable to allocate an internal buffer.
165                         The operation may succeed when buffers become avail-
166                         able.
167
168      [ENOBUFS]          The output queue for a network interface was full.
169                         This generally indicates that the interface has
170                         stopped sending, but may be caused by transient con-
171                         gestion.
172
173      [EACCES]           The SO_BROADCAST option is not set on the socket, and
174                         a broadcast address was given as the destination.
175
176      [EHOSTUNREACH]     The destination address specified an unreachable host.
177
178      [EINVAL]           The flags parameter is invalid.
179
180      [EHOSTDOWN]        The destination address specified a host that is down.
181
182      [ENETDOWN]         The destination address specified a network that is
183                         down.
184
185      [ECONNREFUSED]     The destination host rejected the message (or a previ-
186                         ous one).  This error can only be returned by con-
187                         nected sockets.
188
189      [ENOPROTOOPT]      There was a problem sending the message.  This error
190                         can only be returned by connected sockets.
191
192      [EDESTADDRREQ]     The socket is not connected, and no destination
193                         address was specified.
194
195      [EISCONN]          The socket is already connected, and a destination
196                         address was specified.
197
198      In addition, send() and sendto() may return the following error:
199
200      [EINVAL]           len was larger than SSIZE_MAX.
201
202      Also, sendmsg() may return the following errors:
203
204      [EINVAL]           The sum of the iov_len values in the msg_iov array
205                         overflowed an ssize_t.
206
207      [EMSGSIZE]         The msg_iovlen member of msg was less than 0 or larger
208                         than IOV_MAX.
209
210      [EAFNOSUPPORT]     Addresses in the specified address family cannot be
211                         used with this socket.
212
213 SEE ALSO
214      fcntl(2), getsockopt(2), poll(2), recv(2), select(2), poll(2), socket(2),
215      write(2)
216
217 HISTORY
218      The send() function call appeared in 4.2BSD.
219
220 BSD                              July 28, 1998                             BSD
221     </PRE
222 ></TD
223 ></TR
224 ></TABLE
225 ></DIV
226 ><DIV
227 CLASS="NAVFOOTER"
228 ><HR
229 ALIGN="LEFT"
230 WIDTH="100%"><TABLE
231 SUMMARY="Footer navigation table"
232 WIDTH="100%"
233 BORDER="0"
234 CELLPADDING="0"
235 CELLSPACING="0"
236 ><TR
237 ><TD
238 WIDTH="33%"
239 ALIGN="left"
240 VALIGN="top"
241 ><A
242 HREF="net-common-tcpip-manpages-select.html"
243 ACCESSKEY="P"
244 >Prev</A
245 ></TD
246 ><TD
247 WIDTH="34%"
248 ALIGN="center"
249 VALIGN="top"
250 ><A
251 HREF="ecos-ref.html"
252 ACCESSKEY="H"
253 >Home</A
254 ></TD
255 ><TD
256 WIDTH="33%"
257 ALIGN="right"
258 VALIGN="top"
259 ><A
260 HREF="net-common-tcpip-manpages-shutdown.html"
261 ACCESSKEY="N"
262 >Next</A
263 ></TD
264 ></TR
265 ><TR
266 ><TD
267 WIDTH="33%"
268 ALIGN="left"
269 VALIGN="top"
270 >select</TD
271 ><TD
272 WIDTH="34%"
273 ALIGN="center"
274 VALIGN="top"
275 ><A
276 HREF="tcpip-library-reference.html"
277 ACCESSKEY="U"
278 >Up</A
279 ></TD
280 ><TD
281 WIDTH="33%"
282 ALIGN="right"
283 VALIGN="top"
284 >shutdown</TD
285 ></TR
286 ></TABLE
287 ></DIV
288 ></BODY
289 ></HTML
290 >