.\" Updated 2012-05-04, Akihiro MOTOKI <amotoki@gmail.com>
.\" Updated 2013-03-26, Akihiro MOTOKI <amotoki@gmail.com>
.\"
-.TH SEND 2 2013\-12\-12 Linux "Linux Programmer's Manual"
+.TH SEND 2 2014\-05\-10 Linux "Linux Programmer's Manual"
.SH 名前
send, sendto, sendmsg \- ソケットへメッセージを送る
.SH 書式
メッセージがソケットの送信バッファに入れることができない場合、 \fBsend\fP() は通常は停止 (block) する (ソケットが非停止
(nonblocking) I/O モード でない場合)。非停止モードの場合にはエラー \fBEAGAIN\fP か \fBEWOULDBLOCK\fP
で失敗する。 いつデータをさらに送信できるようになるかを知るために、 \fBselect\fP(2) コールを使用することができる。
-.PP
+.SS フラグ引き数
.\" FIXME ? document MSG_PROXY (which went away in 2.3.15)
\fIflags\fP 引き数は、以下のフラグの (0 個以上の) ビット単位の論理和を とったものを指定する。
.TP
\fBMSG_OOB\fP
\fI帯域外 (out\-of\-band)\fP データをサポートするソケット (例えば \fBSOCK_STREAM\fP) で \fI帯域外\fP
データを送る。下位プロトコルも \fI帯域外\fP データをサポートしている必要がある。
-.PP
-\fImsghdr\fP 構造体の内容は以下の通り。 各フィールドの正確な記述については \fBrecv\fP(2) と以下の説明を参照すること。
+.SS sendmsg()
+The definition of the \fImsghdr\fP structure employed by \fBsendmsg\fP() is as
+follows:
.in +4n
.nf
size_t msg_iovlen; /* msg_iov の要素数 */
void *msg_control; /* 補助データ (後述) */
size_t msg_controllen; /* 補助データバッファ長 */
- int msg_flags; /* 受信メッセージのフラグ */
+ int msg_flags; /* フラグ (未使用) */
};
.fi
.in
.PP
-.\" Still to be documented:
-.\" Send file descriptors and user credentials using the
-.\" msg_control* fields.
-.\" The flags returned in msg_flags.
+The \fImsg_name\fP field is used on an unconnected socket to specify the target
+address for a datagram. It points to a buffer containing the address; the
+\fImsg_name\fP field should be set to the size of the address. For a connected
+socket, these fields should be specified as NULL and 0, respectively.
+
+The \fImsg_iov\fP and \fImsg_iovlen\fP fields specify scatter\-gather locations, as
+for \fBwritev\fP(2).
+
\fImsg_control\fP と \fImsg_controllen\fP メンバーを使用して制御情報を送信することができる。
カーネルが処理できる制御バッファのソケットあたりの最大長は、 \fI/proc/sys/net/core/optmem_max\fP の値に制限されている。
\fBsocket\fP(7) を参照。
+
+.\" Still to be documented:
+.\" Send file descriptors and user credentials using the
+.\" msg_control* fields.
+The \fImsg_flags\fP field is ignored.
.SH 返り値
成功した場合、これらのシステムコールは送信されたバイト数を返す。 エラーの場合、 \-1 を返し、 \fIerrno\fP を適切に設定にする。
.SH エラー
ソケットが非停止に設定されており、 要求された操作が停止した。 POSIX.1\-2001 は、この場合にどちらのエラーを返すことも認めており、 これら
2 つの定数が同じ値を持つことも求めていない。 したがって、移植性が必要なアプリケーションでは、両方の可能性を 確認すべきである。
.TP
+\fBEAGAIN\fP
+(Internet domain datagram sockets) The socket referred to by \fIsockfd\fP had
+not previously been bound to an address and, upon attempting to bind it to
+an ephemeral port, it was determined that all port numbers in the ephemeral
+port range are currently in use. See the discussion of
+\fI/proc/sys/net/ipv4/ip_local_port_range\fP in \fBip\fP(7).
+.TP
\fBEBADF\fP
無効なディスクリプターが指定された。
.TP
\fBsendmmsg\fP(2), \fBshutdown\fP(2), \fBsocket\fP(2), \fBwrite\fP(2), \fBcmsg\fP(3),
\fBip\fP(7), \fBsocket\fP(7), \fBtcp\fP(7), \fBudp\fP(7)
.SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部
である。プロジェクトの説明とバグ報告に関する情報は
http://www.kernel.org/doc/man\-pages/ に書かれている。