1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
|
.\" Copyright (c) 1983, 1991 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: send.2,v 1.7 2000/01/13 20:14:13 argrath Exp $
.\"
.\" Modified Sat Jul 24 01:15:33 1993 by Rik Faith <faith@cs.unc.edu>
.\" Modified Tue Oct 22 17:55:49 1996 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified Oct 1998 by Andi Kleen
.\"
.\" Japanese Version Copyright (c) 1996 HANATAKA Shinya
.\" all rights reserved.
.\" Translated Sun Feb 23 12:05:11 JST 1997
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Translated Sun Aug 15 23:23:45 JST 1999
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Modified Tue Jan 13 01:11:10 JST 2000
.\" by Kentaro Shirakata <argrath@yo.rim.or.jp>
.\"
.\"WORD: socket å
.\"WORD: message å
.\"WORD: protocol ץȥ
.\"WORD: non-blocking I/O I/O
.\"WORD: block (block)
.\"WORD: out-of-band Ӱ賰
.\"WORD: descriptor ǥץ
.\"WORD: parameter ѥ
.\"WORD: queue 塼
.\"WORD: buffer Хåե
.\"WORD: routing 롼ƥ
.\"WORD: congestion
.\"
.TH SEND 2 "July 1999" "Linux Man Page" "Linux Programmer's Manual"
.SH ̾
send, sendto, sendmsg \- åȤإå
.SH
.B #include <sys/types.h>
.br
.B #include <sys/socket.h>
.sp
.BI "int send(int " s ", const void *" msg ", size_t " len ","
.BI "int " flags );
.br
.BI "int sendto(int " s ", const void *" msg ", size_t " len ","
.BI "int " flags ", const struct sockaddr *" to ", socklen_t " tolen );
.br
.BI "int sendmsg(int " s ", const struct msghdr *" msg ","
.BI "int " flags );
.SH
.BR send ,
.BR sendto ,
.B sendmsg
¾Υå(socket)إåžΤ˻Ѥ롣
.B send
ϥåȤ
.I ³줿(connected)
֤ˤˤΤѤǤ롣
.B sendto
.B sendmsg
ϤĤǤѤǤ롣
.PP
ŪϤΥɥ쥹
.I to
Ȥ礭ꤹ
.I tolen
Ϳ롣åĹ
.IR len
Ϳ롣
⤷åѤץȥưŪ̲᤹ˤĹ
.B EMSGSIZE
顼֤졢åžʤ
.PP
.BR send
ǤμԤŪˤϼʤ
ȯ줿顼 \-1 ֤ȤˤäƻŦ롣
.PP
ååȤХåե뤳ȤǤʤ硢
.B send
̾ϥåȤ(non-blocking) I/O ⡼ɤǤʤ(block)롣
ߥ⡼ɤξˤ
.B EAGAIN
֤˥ǡ뤳ȤǽɤĴ٤뤿
.BR select (2)
Ѥ뤳ȤǤ롣
.PP
.I flags
ѥϥե饰ǡʲΤΤޤ뤳ȤǤ:
.\" XXX document MSG_PROXY
.TP
.B MSG_OOB
ե饰
.I Ӱ賰(out-of-band)
ǡݡȤ륽å(㤨
.BR SOCK_STREAM
)
.I Ӱ賰
ǡ롣̥ץȥ
.I Ӱ賰
ǡݡȤƤɬפ롣
.TP
.B MSG_DONTROUTE
ѥåȤФΤ˥ȥѤ
ľܥͥåȥ³ƤۥȤˤ롣
Ͽ(diagnostic)롼ƥץˤäƤΤѤ롣
Ϸϩ椵ץȥեߥˤƤ롣
ѥåȥåȤˤƤʤ
.TP
.B MSG_DONTWAIT
֥åͭˤ롣⤷֥å줿ˤ
.B EAGAIN
֤褦ˤ롣
(Ϥޤ
.BR fcntl(2)
.B F_SETFL
.B O_NONBLOCK
ꤹ뤳ȤˤäƤͭˤǤ)
.TP
.B MSG_NOSIGNAL
ȥظΥåȤ¦³Ǥˡ顼Ȥ
.B SIGPIPE
ʤ褦᤹롣ξǤ
.B EPIPE
֤롣
.PP
.I msghdr
¤ΤƤˤĤƤ
.BR recv (2)
Ȥ뤳ȡ
.I msg_control
.I msg_controllen
СѤ뤳ȤǤ롣
ͥνǤХåեκĹϡåȤ
.B net.core.optmem_max
sysctl ¤Ƥ롣
.BR socket (7)
Ȥ뤳ȡ
.SH ֤
Υä饯ο֤顼ä
\-1 ֤롣
.SH 顼
ϥåؤȯŪʥ顼Ǥ롣ؤ
ץȥ롦⥸塼뤫֤¾Υ顼뤫⤷ʤ
줾Υޥ˥奢Ȥ뤳ȡ
.TP
.B EBADF
̵ʥǥץ(descriptor)ꤵ줿
.TP
.B ENOTSOCK
.I s
åȤǤʤ
.TP
.B EFAULT
桼֤Ȥʥɥ쥹ѥȤƻꤵ줿
.TP
.B EMSGSIZE
åȤåưŪž褦˵줿å
礭뤿ԲǽǤ롣
.TP
.BR EAGAIN " ޤ " EWOULDBLOCK
åȤ(non-blocking)ꤵƤꡢ
ᤵ줿(block)
.TP
.B ENOBUFS
ͥåȥեΤνϥ塼(queue)դǤ롣
ϰ̤˰Ū(congestion)Τ˥ե
ߤƤ뤳Ȥ̣롣
( Linux ǤȯʤǥХΥ塼Сե
ˤϥѥåȤۤäƼΤƤ)
.TP
.B EINTR
ʥ뤬ȯ
.TP
.B ENOMEM
꤬ʤ
.TP
.B EINVAL
ʰϤ줿
.TP
.B EPIPE
³ظΥåȤǥüĤ(shutdown)Ƥ롣
ξˤ
.B MSG_NOSIGNAL
ꤵƤʤСץƱ
.B SIGPIPE
롣
.SH
4.4BSD, SVr4, POSIX 1003.1g draft
(δؿ 4.2BSD Ǻǽ˸줿)
.SH
嵭Υץȥפ Single Unix Specification ˽äƤ롣
glibc2 ƱͤǤ롣
.I flags
BSD 4.* Ǥ int Ǥꡢlibc4 libc5 Ǥ unsigned int Ǥ롣
.I len
BSD 4.* libc4 Ǥ int Ǥꡢlibc5 Ǥ `size_t' Ǥ롣
.I tolen
BSD 4.* libc4 libc5 Ǥ `int' Ǥ롣
.BR accept (2)
Ȥ뤳ȡ
.SH Ϣ
.BR fcntl (2),
.BR recv (2),
.BR select (2),
.BR getsockopt (2),
.BR sendfile (2),
.BR socket (2),
.BR write (2),
.BR socket (7),
.BR ip (7),
.BR tcp (7),
.BR udp (7)
|