.\" This file was generated with po4a. Translate the source file.
.\"
.\"*******************************************************************
+.\"
+.\" Japanese Version Copyright (c) 1997-1999 HANATAKA Shinya
+.\" all rights reserved.
+.\" Translated Sat Apr 3 14:53:19 JST 1999
+.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
+.\" Updated Tue Nov 26 JST 2002 by Kentaro Shirakata <argrath@ub32.org>
+.\" Updated 2013-05-06, Akihiro MOTOKI <amotoki@gmail.com>
+.\" Updated 2013-07-22, Akihiro MOTOKI <amotoki@gmail.com>
+.\"
.TH GETPEERNAME 2 2013\-02\-12 Linux "Linux Programmer's Manual"
.SH 名前
getpeername \- 接続している相手ソケットの名前を取得する
.SH 準拠
SVr4, 4.4BSD (\fBgetpeername\fP() 関数は 4.2BSD で登場した), POSIX.1\-2001.
.SH 注意
-\fBgetpeername\fP() の三番目の引き数は実際には \fI`int *'\fP である (4.x BSD, libc4, libc5 では
+\fBgetpeername\fP() の三番目の引き数は実際には \fI`int\ *'\fP である (4.x BSD, libc4, libc5 では
このようになっている)。 POSIX では紆余曲折を経て現在の \fIsocklen_t\fP になっており、 glibc でも \fIsocklen_t\fP
を使っている。 \fBaccept\fP(2) も参照のこと。
-For stream sockets, once a \fBconnect\fP(2) has been performed, either socket
-can call \fBgetpeername\fP() to obtain the address of the peer socket. On the
-other hand, datagram sockets are connectionless. Calling \fBconnect\fP(2) on
-a datagram socket merely sets the peer address for outgoing datagrams sent
-with \fBwrite\fP(2) or \fBrecv\fP(2). The caller of \fBconnect\fP(2) can use
-\fBgetpeername\fP() to obtain the peer address that it earlier set for the
-socket. However, the peer socket is unaware of this information, and
-calling \fBgetpeername\fP() on the peer socket will return no useful
-information (unless a \fBconnect\fP(2) call was also executed on the peer).
-Note also that the receiver of a datagram can obtain the address of the
-sender when using \fBrecvfrom\fP(2).
+ストリームソケットでは、 いったん \fBconnect\fP(2) が実行されると、 どのソケットも \fBgetpeername\fP()
+を使って相手ソケットのアドレスを取得できる。 一方、データグラムソケットはコネクションレスである (接続がない)。 データグラムソケットに対する
+\fBconnect\fP(2) の呼び出しは、 \fBwrite\fP(2) や \fBrecv\fP(2)
+で送信される出力データグラムの相手アドレスを設定するだけである。
+\fBconnect\fP(2) の呼び出し元は、 \fBgetpeername\fP()
+を使って、それ以前にそのソケットに設定された相手アドレスを取得することができる。 しかし、相手ソケットはこの情報を知らないので、 相手ソケットで
+\fBgetpeername\fP() を呼び出しても、 役に立つ情報は得られない (相手側でも \fBconnect\fP(2) が呼び出されている場合を除く)。
+なお、データグラムの受信側では \fBrecvfrom\fP(2) を使って送信元アドレスを 取得できることも覚えておいてほしい。
.SH 関連項目
\fBaccept\fP(2), \fBbind\fP(2), \fBgetsockname\fP(2), \fBip\fP(7), \fBsocket\fP(7),
\fBunix\fP(7)
.SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.51 の一部
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部
である。プロジェクトの説明とバグ報告に関する情報は
http://www.kernel.org/doc/man\-pages/ に書かれている。