OSDN Git Service

7959bb35f4de9fee8ff71d4a5c8d5d5c8b31181d
[linuxjm/LDP_man-pages.git] / draft / man2 / socket.2
1 '\" t
2 .\" Copyright (c) 1983, 1991 The Regents of the University of California.
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\"    must display the following acknowledgement:
15 .\"     This product includes software developed by the University of
16 .\"     California, Berkeley and its contributors.
17 .\" 4. Neither the name of the University nor the names of its contributors
18 .\"    may be used to endorse or promote products derived from this software
19 .\"    without specific prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" SUCH DAMAGE.
32 .\"
33 .\"     $Id: socket.2,v 1.4 1999/05/13 11:33:42 freitag Exp $
34 .\"
35 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
36 .\" Modified 1996-10-22 by Eric S. Raymond <esr@thyrsus.com>
37 .\" Modified 1998, 1999 by Andi Kleen <ak@muc.de>
38 .\" Modified 2002-07-17 by Michael Kerrisk <mtk.manpages@gmail.com>
39 .\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
40 .\"
41 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
42 .\"         all rights reserved.
43 .\" Translated Mon Mar  3 23:40:11 JST 1997
44 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
45 .\" Modified Sun Aug 15 23:52:28 JST 1999
46 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
47 .\" Updated Mon Jan 13 JST 2000 by Kentaro Shirakata <argrath@ub32.org>
48 .\" Updated Mon Oct 15 JST 2001 by Kentaro Shirakata <argrath@ub32.org>
49 .\" Updated Mon Oct 26 JST 2002 by Kentaro Shirakata <argrath@ub32.org>
50 .\" Updated 2008-11-09, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.13
51 .\"
52 .\"WORD:        endpoint                端点
53 .\"WORD:        descriptor              ディスクリプター
54 .\"WORD:        link layer              リンク層
55 .\"WORD:        byte stream             バイト・ストリーム
56 .\"WORD:        out-of-band             帯域外
57 .\"WORD:        sequenced               順序性のある
58 .\"WORD:        reliable                信頼性のある
59 .\"WORD:        two-way                 双方向の
60 .\"WORD:        datagram                データグラム
61 .\"WORD:        implement               実装
62 .\"WORD:        super-user              スーパー・ユーザー
63 .\"WORD:        full-duplex             全二重
64 .\"WORD:        non-blocking I/O        非停止 I/O
65 .\"WORD:        asynchronous            非同期
66 .\"
67 .TH SOCKET 2 2009-01-19 "Linux" "Linux Programmer's Manual"
68 .\"O .SH NAME
69 .SH 名前
70 .\"O socket \- create an endpoint for communication
71 socket \- 通信のための端点(endpoint)を作成する
72 .\"O .SH SYNOPSIS
73 .SH 書式
74 .\"O .BR "#include <sys/types.h>" "          /* See NOTES */"
75 .BR "#include <sys/types.h>" "          /* 「注意」参照 */"
76 .br
77 .B #include <sys/socket.h>
78 .sp
79 .BI "int socket(int " domain ", int " type ", int " protocol );
80 .\"O .SH DESCRIPTION
81 .SH 説明
82 .\"O .BR socket ()
83 .\"O creates an endpoint for communication and returns a descriptor.
84 .BR socket ()
85 は通信のための端点(endpoint)を作成し、ディスクリプター(descriptor)を返す。
86 .PP
87 .\"O The
88 .\"O .I domain
89 .\"O argument specifies a communication domain; this selects the protocol
90 .\"O family which will be used for communication.
91 .\"O These families are defined in
92 .\"O .IR <sys/socket.h> .
93 .\"O The currently understood formats include:
94 .I domain
95 引数は通信を行なうドメインを指定する; これはどの
96 プロトコル・ファミリ(protocol family)を通信に使用するかを指定する。
97 これらのファミリは
98 .I <sys/socket.h>
99 に定義されている。
100 現在、理解できるフォーマットは以下の通り。
101 .TS
102 tab(:);
103 l l l.
104 .\"O Name:Purpose:Man page
105 名前:目的:マニュアル
106 T{
107 .BR AF_UNIX ", " AF_LOCAL
108 T}:T{
109 .\"O Local communication
110 ローカル通信
111 T}:T{
112 .BR unix (7)
113 T}
114 T{
115 .B AF_INET
116 .\"O T}:IPv4 Internet protocols:T{
117 T}:IPv4 インターネット・プロトコル:T{
118 .BR ip (7)
119 T}
120 T{
121 .B AF_INET6
122 .\"O T}:IPv6 Internet protocols:T{
123 T}:IPv6 インターネット・プロトコル:T{
124 .BR ipv6 (7)
125 T}
126 T{
127 .B AF_IPX
128 .\"O T}:IPX \- Novell protocols:
129 T}:IPX \- Novell プロトコル:
130 T{
131 .B AF_NETLINK
132 T}:T{
133 .\"O Kernel user interface device
134 カーネル・ユーザ・デバイス
135 T}:T{
136 .BR netlink (7)
137 T}
138 T{
139 .B AF_X25
140 .\"O T}:ITU-T X.25 / ISO-8208 protocol:T{
141 T}:ITU-T X.25 / ISO-8208 プロトコル:T{
142 .BR x25 (7)
143 T}
144 T{
145 .B AF_AX25
146 T}:T{
147 .\"O Amateur radio AX.25 protocol
148 アマチュア無線 AX.25 プロトコル
149 T}:
150 T{
151 .B AF_ATMPVC
152 .\"O T}:Access to raw ATM PVCs:
153 T}:生の ATM PVC にアクセスする:
154 T{
155 .B AF_APPLETALK
156 .\"O T}:Appletalk:T{
157 T}:アップルトーク:T{
158 .BR ddp (7)
159 T}
160 T{
161 .B AF_PACKET
162 T}:T{
163 .\"O Low level packet interface
164 低レベルのパケットインターフェース
165 T}:T{
166 .BR packet (7)
167 T}
168 .TE
169 .PP
170 .\"O The socket has the indicated
171 .\"O .IR type ,
172 .\"O which specifies the communication semantics.
173 .\"O Currently defined types
174 .\"O are:
175 ソケットは
176 .I type
177 で指定される型を持ち、それは通信方式(semantics)を指定する。
178 定義されている型は現在以下の通り。
179 .TP 16
180 .B SOCK_STREAM
181 .\"O Provides sequenced, reliable, two-way, connection-based byte streams.
182 .\"O An out-of-band data transmission mechanism may be supported.
183 順序性と信頼性があり、双方向の、接続された
184 バイト・ストリーム(byte stream)を提供する。
185 帯域外(out-of-band)データ転送メカニズムもサポートされる。
186 .TP
187 .B SOCK_DGRAM
188 .\"O Supports datagrams (connectionless, unreliable messages of a fixed
189 .\"O maximum length).
190 データグラム(接続、信頼性無し、固定最大長メッセージ)
191 をサポートする。
192 .TP
193 .B SOCK_SEQPACKET
194 .\"O Provides a sequenced, reliable, two-way connection-based data
195 .\"O transmission path for datagrams of fixed maximum length; a consumer is
196 .\"O required to read an entire packet with each input system call.
197 固定最大長のデータグラム転送パスに基づいた順序性、信頼性のある
198 双方向の接続に基づいた通信を提供する。受け取り側ではそれぞれの入力
199 システム・コールでパケット全体を読み取ることが要求される。
200 .TP
201 .B SOCK_RAW
202 .\"O Provides raw network protocol access.
203 生のネットワーク・プロトコルへのアクセスを提供する。
204 .TP
205 .B SOCK_RDM
206 .\"O Provides a reliable datagram layer that does not guarantee ordering.
207 信頼性はあるが、順序は保証しないデータグラム層を提供する。
208 .TP
209 .B SOCK_PACKET
210 .\"O Obsolete and should not be used in new programs;
211 .\"O see
212 .\"O .BR packet (7).
213 廃止されており新しいプログラムで使用してはいけない。
214 .BR packet (7)
215 を参照すること
216 .PP
217 .\"O Some socket types may not be implemented by all protocol families;
218 .\"O for example,
219 .\"O .B SOCK_SEQPACKET
220 .\"O is not implemented for
221 .\"O .BR AF_INET .
222 ある種のソケット型が全てのプロトコル・ファミリで実装されているわけではない。
223 例えば
224 .B SOCK_SEQPACKET
225
226 .B AF_INET
227 には実装されていない。
228 .PP
229 .\"O Since Linux 2.6.27, the
230 .\"O .I type
231 .\"O argument serves a second purpose:
232 .\"O in addition to specifying a socket type,
233 .\"O it may include the bitwise OR of any of the following values,
234 .\"O to modify the behavior of
235 .\"O .BR socket ():
236 Linux 2.6.27 以降では、
237 .I type
238 引数は二つ目の目的にも使用される。
239 ソケットの型を指定するのに加えて、
240 以下の値のいくつかをビット単位の論理和 (OR) で指定することで、
241 .BR socket ()
242 の振舞いを変更することができる。
243 .TP 16
244 .B SOCK_NONBLOCK
245 .\"O Set the
246 .\"O .BR O_NONBLOCK
247 .\"O file status flag on the new open file description.
248 .\"O Using this flag saves extra calls to
249 .\"O .BR fcntl (2)
250 .\"O to achieve the same result.
251 新しく生成されるオープンファイル記述 (open file description) の
252 .B O_NONBLOCK
253 ファイルステータスフラグをセットする。
254 このフラグを使うことで、
255 .B O_NONBLOCK
256 をセットするために
257 .BR fcntl (2)
258 を追加で呼び出す必要がなくなる。
259 .TP
260 .B SOCK_CLOEXEC
261 .\"O Set the close-on-exec
262 .\"O .RB ( FD_CLOEXEC )
263 .\"O flag on the new file descriptor.
264 .\"O See the description of the
265 .\"O .B O_CLOEXEC
266 .\"O flag in
267 .\"O .BR open (2)
268 .\"O for reasons why this may be useful.
269 新しいファイル・ディスクリプターに対して
270 close-on-exec
271 .RB ( FD_CLOEXEC )
272 フラグをセットする。
273 このフラグが役に立つ理由については、
274 .BR open (2)
275
276 .B O_CLOEXEC
277 フラグの説明を参照のこと。
278 .PP
279 .\"O The
280 .\"O .I protocol
281 .\"O specifies a particular protocol to be used with the socket.
282 .\"O Normally only a single protocol exists to support a particular
283 .\"O socket type within a given protocol family, in which case
284 .\"O .I protocol
285 .\"O can be specified as 0.
286 .\"O However, it is possible that many protocols may exist, in
287 .\"O which case a particular protocol must be specified in this manner.
288 .\"O The protocol number to use is specific to the \*(lqcommunication domain\*(rq
289 .\"O in which communication is to take place; see
290 .\"O .BR protocols (5).
291 .\"O See
292 .\"O .BR getprotoent (3)
293 .\"O on how to map protocol name strings to protocol numbers.
294 .I protocol
295 はソケットによって使用される固有のプロトコルを指定する。通常それぞれの
296 ソケットは、与えられたプロトコル・ファミリの種類ごとに一つのプロトコルのみを
297 サポートする。
298 その場合は
299 .I protocol
300 に 0 を指定できる。
301 しかし、多くのプロトコルが存在してもかまわない。
302 この場合にはこの方法により固有のプロトコルを指定する必要がある。
303 使用されるプロトコル番号は通信の行なわれる\*(lq通信ドメイン\*(rqに
304 固有である;
305 .BR protocols (5)
306 を参照すること。
307 プロトコル名をどうやってプロトコル番号に対応させるかについては
308 .BR getprotoent (3)
309 を参照すること。
310 .PP
311 .\"O Sockets of type
312 .\"O .B SOCK_STREAM
313 .\"O are full-duplex byte streams, similar to pipes.
314 .\"O They do not preserve
315 .\"O record boundaries.
316 .\"O A stream socket must be in
317 .\"O a
318 .\"O .I connected
319 .\"O state before any data may be sent or received on it.
320 .\"O A connection to
321 .\"O another socket is created with a
322 .\"O .BR connect (2)
323 .\"O call.
324 .\"O Once connected, data may be transferred using
325 .\"O .BR read (2)
326 .\"O and
327 .\"O .BR write (2)
328 .\"O calls or some variant of the
329 .\"O .BR send (2)
330 .\"O and
331 .\"O .BR recv (2)
332 .\"O calls.
333 .\"O When a session has been completed a
334 .\"O .BR close (2)
335 .\"O may be performed.
336 .\"O Out-of-band data may also be transmitted as described in
337 .\"O .BR send (2)
338 .\"O and received as described in
339 .\"O .BR recv (2).
340 .B SOCK_STREAM
341 型のソケットはパイプのような全二重バイト・ストリームである。
342 これらはレコード境界を保存しない。
343 ストリームは、ソケットがデータを送ったり受けたりする前に
344 .I 接続された
345 状態になってなければならない。他のソケットへの接続は
346 .BR connect (2)
347 コールによって行なわれる。一度接続したらデータは
348 .BR read (2)
349
350 .BR write (2)
351 コールや
352 .BR send (2)
353
354 .BR recv (2)
355 コールの変種を使用して転送できる。
356 セッションが完了したら
357 .BR close (2)
358 が行なわれる。帯域外データの転送も
359 .BR send (2)
360 に記述されており、
361 受信も
362 .BR recv (2)
363 に記述されている。
364 .PP
365 .\"O The communications protocols which implement a
366 .\"O .B SOCK_STREAM
367 .\"O ensure that data is not lost or duplicated.
368 .\"O If a piece of data for which
369 .\"O the peer protocol has buffer space cannot be successfully transmitted
370 .\"O within a reasonable length of time, then the connection is considered
371 .\"O to be dead.
372 .\"O When
373 .\"O .B SO_KEEPALIVE
374 .\"O is enabled on the socket the protocol checks in a protocol-specific
375 .\"O manner if the other end is still alive.
376 .B SOCK_STREAM
377 を実装した通信プロトコルはデータに損失や重複がないことを保証する。
378 もし相手のプロトコルがバッファー空間を持つ
379 データの断片を適当な時間のうちに転送できなければ、
380 接続は断たれたとみなす。そのソケット
381 .B SO_KEEPALIVE
382 が有効になっている場合、プロトコル独自の方法で接続の相手側がまだ
383 有効であるかをチェックする。
384 .\"O A
385 .\"O .B SIGPIPE
386 .\"O signal is raised if a process sends or receives
387 .\"O on a broken stream; this causes naive processes,
388 .\"O which do not handle the signal, to exit.
389 もしプロセスが、壊れたストリームでデータを送受信しようとした場合には
390 .B SIGPIPE
391 シグナルが送られる; これは通常のそのシグナルを扱っていないプロセスを
392 終了させる。
393 .\"O .B SOCK_SEQPACKET
394 .\"O sockets employ the same system calls as
395 .\"O .B SOCK_STREAM
396 .\"O sockets.
397 .\"O The only difference is that
398 .\"O .BR read (2)
399 .\"O calls will return only the amount of data requested,
400 .\"O and any data remaining in the arriving packet will be discarded.
401 .\"O Also all message boundaries in incoming datagrams are preserved.
402 .B SOCK_SEQPACKET
403 ソケットは
404 .B SOCK_STREAM
405 ソケットと同じシステム・コールを使用する。
406 唯一の違いは
407 .BR read (2)
408 コールが要求された量のデータのみを返し、到着したパケットの残りの部分を
409 捨ててしまうことである。同様に入ってくるデータグラムの全てのメッセージ境界は
410 保存される。
411 .PP
412 .\"O .B SOCK_DGRAM
413 .\"O and
414 .\"O .B SOCK_RAW
415 .\"O sockets allow sending of datagrams to correspondents named in
416 .\"O .BR sendto (2)
417 .\"O calls.
418 .\"O Datagrams are generally received with
419 .\"O .BR recvfrom (2),
420 .\"O which returns the next datagram along with the address of its sender.
421 .B SOCK_DGRAM
422
423 .B SOCK_RAW
424 ソケットは
425 .BR sendto (2)
426 コールで指定された相手へデータグラムを送ることが許されている。
427 データグラムは一般に
428 .BR recvfrom (2)
429 で受けとり、
430 このコールは次のデータグラムを送信者のアドレスと一緒に返す。
431 .PP
432 .\"O .B SOCK_PACKET
433 .\"O is an obsolete socket type to receive raw packets directly from the
434 .\"O device driver.
435 .\"O Use
436 .\"O .BR packet (7)
437 .\"O instead.
438 .B SOCK_PACKET
439 は古いソケット型で、生(raw)のパケットをデバイスドライバから
440 直接受信するためのものである。
441 今は代わりに
442 .BR packet (7)
443 を用いること。
444 .PP
445 .\"O An
446 .\"O .BR fcntl (2)
447 .\"O .B F_SETOWN
448 .\"O operation can be used to specify a process or process group to receive a
449 .\"O .B SIGURG
450 .\"O signal when the out-of-band data arrives or
451 .\"O .B SIGPIPE
452 .\"O signal when a
453 .\"O .B SOCK_STREAM
454 .\"O connection breaks unexpectedly.
455 .BR fcntl (2)
456
457 .B F_SETOWN
458 操作を使って、シグナル
459 .B SIGURG
460
461 .B SIGPIPE
462 を受けとるプロセス・グループを指定できる。
463 .B SIGURG
464 シグナルは帯域外データが到着した時に、
465 .B SIGPIPE
466 シグナルは
467 .B SOCK_STREAM
468 接続が予期せず切断された時に送られる。
469 .\"O This operation may also be used to set the process or process group
470 .\"O that receives the I/O and asynchronous notification of I/O events via
471 .\"O .BR SIGIO .
472 また、
473 .B F_SETOWN
474 操作は、I/O や I/O イベントの非同期 (asynchronous) 通知を
475 .B SIGIO
476 を経由で受け取るプロセスやプロセス・グループを設定するのにも使用できる。
477 .\"O Using
478 .\"O .B F_SETOWN
479 .\"O is equivalent to an
480 .\"O .BR ioctl (2)
481 .\"O call with the
482 .\"O .B FIOSETOWN
483 .\"O or
484 .\"O .B SIOCSPGRP
485 .\"O argument.
486 .B F_SETOWN
487 を使用することは
488 .B FIOSETOWN
489 または
490 .B SIOCSPGRP
491 の引数で
492 .BR ioctl (2)
493 を使用することと等価である。
494 .PP
495 .\"O When the network signals an error condition to the protocol module (e.g.,
496 .\"O using a ICMP message for IP) the pending error flag is set for the socket.
497 .\"O The next operation on this socket will return the error code of the pending
498 .\"O error.
499 .\"O For some protocols it is possible to enable a per-socket error queue
500 .\"O to retrieve detailed information about the error; see
501 .\"O .B IP_RECVERR
502 .\"O in
503 .\"O .BR ip (7).
504 ネットワークがプロトコル・モジュールにエラー状態を伝えた場合
505 (例えば、IP の ICMP メッセージを使用して)には、ソケットの
506 ペンディング・エラー・フラグが設定される。次にこのソケットを操作した
507 時にペンディングされていたエラー・コードが返される。プロトコルによっては
508 エラーについてのより詳しい情報を受け取るためにソケットごとのエラー・キューを
509 受け取ることが可能である。
510 .BR ip (7)
511
512 .B IP_RECVERR
513 を参照すること。
514 .PP
515 .\"O The operation of sockets is controlled by socket level
516 .\"O .IR options .
517 .\"O These options are defined in
518 .\"O .IR <sys/socket.h> .
519 .\"O The functions
520 .\"O .BR setsockopt (2)
521 .\"O and
522 .\"O .BR getsockopt (2)
523 .\"O are used to set and get options, respectively.
524 ソケットの操作はソケット・レベル
525 .I options
526 によって制御される。
527 これらのオプションは
528 .I <sys/socket.h>
529 に定義されている。
530 .BR setsockopt (2)
531
532 .BR getsockopt (2)
533 関数はそれぞれオプションの設定と取得を行なう。
534 .\"O .SH "RETURN VALUE"
535 .SH 返り値
536 .\"O On success, a file descriptor for the new socket is returned.
537 .\"O On error, \-1 is returned, and
538 .\"O .I errno
539 .\"O is set appropriately.
540 成功した場合、新しいソケットのファイル・ディスクリプターを返す。
541 エラーが発生した場合は \-1 を返し、
542 .I errno
543 を適切に設定する。
544 .\"O .SH ERRORS
545 .SH エラー
546 .TP
547 .B EACCES
548 .\"O Permission to create a socket of the specified type and/or protocol
549 .\"O is denied.
550 指定されたタイプまたはプロトコルのソケットを作成する許可が与えられていない。
551 .TP
552 .B EAFNOSUPPORT
553 .\"O The implementation does not support the specified address family.
554 指定されたアドレスファミリーがサポートされていない。
555 .TP
556 .B EINVAL
557 .\"O Unknown protocol, or protocol family not available.
558 知らないプロトコル、または利用できないプロトコル・ファミリである。
559 .TP
560 .B EINVAL
561 .\" Since Linux 2.6.27
562 .\"O Invalid flags in
563 .\"O .IR type .
564 .I type
565 に無効なフラグが指定されている。
566 .TP
567 .B EMFILE
568 .\"O Process file table overflow.
569 プロセスのファイルテーブルが溢れている。
570 .TP
571 .B ENFILE
572 .\"O The system limit on the total number of open files has been reached.
573 オープンされたファイルの総数がシステム上限に達している。
574 .TP
575 .\"O .BR ENOBUFS " or " ENOMEM
576 .BR ENOBUFS " または " ENOMEM
577 .\"O Insufficient memory is available.
578 .\"O The socket cannot be
579 .\"O created until sufficient resources are freed.
580 十分なメモリがない。十分な資源が解放されるまではソケットを
581 作成することはできない。
582 .TP
583 .B EPROTONOSUPPORT
584 .\"O The protocol type or the specified protocol is not
585 .\"O supported within this domain.
586 このドメインでは指定されたプロトコルまたはプロトコル・タイプが
587 サポートされていない。
588 .PP
589 .\"O Other errors may be generated by the underlying protocol modules.
590 下位のプロトコル・モジュールから他のエラーが生成されるかもしれない。
591 .\"O .SH "CONFORMING TO"
592 .SH 準拠
593 4.4BSD, POSIX.1-2001.
594
595 .\"O The
596 .\"O .B SOCK_NONBLOCK
597 .\"O and
598 .\"O .B SOCK_CLOEXEC
599 .\"O flags are Linux-specific.
600 フラグ
601 .BR SOCK_NONBLOCK ,
602 .B SOCK_CLOEXEC
603 は Linux 固有である。
604
605 .\"O .BR socket ()
606 .\"O appeared in 4.2BSD.
607 .\"O It is generally portable to/from
608 .\"O non-BSD systems supporting clones of the BSD socket layer (including
609 .\"O System V variants).
610 .BR socket ()
611 は 4.2BSD で登場した。一般に、(System V の変種を含めて)
612 BSD のソケット層の互換性をサポートしている BSD 以外のシステムへの、
613 または、BSD 以外のシステムからの移植ができる。
614 .\"O .SH NOTES
615 .SH 注意
616 .\"O POSIX.1-2001 does not require the inclusion of
617 .\"O .IR <sys/types.h> ,
618 .\"O and this header file is not required on Linux.
619 .\"O However, some historical (BSD) implementations required this header
620 .\"O file, and portable applications are probably wise to include it.
621 POSIX.1-2001 では
622 .I <sys/types.h>
623 のインクルードは必須とされておらず、
624 Linux ではこのヘッダファイルは必要ではない。
625 しかし、歴史的には、いくつかの実装 (BSD 系) でこのヘッダファイルが
626 必要であり、移植性が必要なアプリケーションではこのファイルを
627 インクルードするのが賢明であろう。
628
629 .\"O The manifest constants used under 4.x BSD for protocol families
630 .\"O are
631 .\"O .BR PF_UNIX ,
632 .\"O .BR PF_INET ,
633 .\"O etc., while
634 .\"O .B AF_UNIX
635 .\"O etc. are used for address
636 .\"O families.
637 .\"O However, already the BSD man page promises: "The protocol
638 .\"O family generally is the same as the address family", and subsequent
639 .\"O standards use AF_* everywhere.
640 4.x BSD において定数を使用する場合、プロトコル・ファミリーには
641 .BR PF_UNIX ,
642 .B PF_INET
643 等を使用している。一方でアドレス・ファミリーには
644 .B AF_UNIX
645 等が使用されている。しかしながら BSD のマニュアルでは
646 「一般にプロトコル・ファミリーはアドレス・ファミリーと同じものである。」
647 と保証している。それでそれ以外の規格では全ての場所で AF_* が使用されている。
648 .\"O .SH EXAMPLE
649 .SH 例
650 .\"O An example of the use of
651 .\"O .BR socket ()
652 .\"O is shown in
653 .\"O .BR getaddrinfo (3).
654 .BR socket ()
655 の利用例が
656 .BR getaddrinfo (3)
657 に記載されている。
658 .\"O .SH "SEE ALSO"
659 .SH 関連項目
660 .BR accept (2),
661 .BR bind (2),
662 .BR connect (2),
663 .BR fcntl (2),
664 .BR getpeername (2),
665 .BR getsockname (2),
666 .BR getsockopt (2),
667 .BR ioctl (2),
668 .BR listen (2),
669 .BR read (2),
670 .BR recv (2),
671 .BR select (2),
672 .BR send (2),
673 .BR shutdown (2),
674 .BR socketpair (2),
675 .BR write (2),
676 .BR getprotoent (3),
677 .BR ip (7),
678 .BR socket (7),
679 .BR tcp (7),
680 .BR udp (7),
681 .BR unix (7)
682 .PP
683 .\"O \(lqAn Introductory 4.3BSD Interprocess Communication Tutorial\(rq
684 .\"O is reprinted in
685 .\"O .I UNIX Programmer's Supplementary Documents Volume 1.
686 \(lqAn Introductory 4.3BSD Interprocess Communication Tutorial\(rq
687
688 .I UNIX Programmer's Supplementary Documents Volume 1
689 として再版された。
690 .PP
691 .\"O \(lqBSD Interprocess Communication Tutorial\(rq
692 .\"O is reprinted in
693 .\"O .I UNIX Programmer's Supplementary Documents Volume 1.
694 \(lqBSD Interprocess Communication Tutorial\(rq
695
696 .I UNIX Programmer's Supplementary Documents Volume 1
697 として再版された。