tags 674034 fixed-upstream
thanks

On Tue, May 22, 2012 at 6:53 PM, Kai Kunschke <k...@kunfoo.org> wrote:
> Package: manpages-dev
> Version: 3.27-1
> Severity: minor
> Tags: upstream patch
>
>
> Subject: /usr/share/man/man2/getpeername.2.gz: please mention that 
> getpeername() does not work with udp connections as one could expect
> Package: manpages-dev
> Version: 3.27-1
> File: /usr/share/man/man2/getpeername.2.gz
> Severity: minor
> Tags: patch upstream
>
> getpeername() will never deliver the address of a udp client on server
> side, even if he called connect(). The way to go is recvfrom(). A note
> in the manpage would have saved me a lot of time.

I've applie dthe patch below upstream.

Cheers,

Michael

--- a/man2/getpeername.2
+++ b/man2/getpeername.2
@@ -37,7 +37,7 @@
 .\" Modified 17 Jul 2002, Michael Kerrisk <mtk.manpa...@gmail.com>
 .\"    Added 'socket' to NAME, so that "man -k socket" will show this page.
 .\"
-.TH GETPEERNAME 2 2008-12-03 "Linux" "Linux Programmer's Manual"
+.TH GETPEERNAME 2 2013-02-12 "Linux" "Linux Programmer's Manual"
 .SH NAME
 getpeername \- get name of connected peer socket
 .SH SYNOPSIS
@@ -111,6 +111,34 @@ Some POSIX confusion resulted in the present
 also used by glibc.
 See also
 .BR accept (2).
+
+For stream sockets, once a
+.BR connect (2)
+has been performed, either socket can call
+.BR getpeername ()
+to obtain the address of the peer socket.
+On the other hand, datagram sockets are connectionless.
+Calling
+.BR connect (2)
+on a datagram socket merely sets the peer address for outgoing
+datagrams sent with
+.BR write (2)
+or
+.BR recv (2).
+The caller of
+.BR connect (2)
+can use
+.BR getpeername ()
+to obtain the peer address that it earlier set for the socket.
+However, the peer socket is unaware of this information, and calling
+.BR getpeername ()
+on the peer socket will return no useful information (unless a
+.BR connect (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
+.BR recvfrom (2).
+
 .SH "SEE ALSO"
 .BR accept (2),
 .BR bind (2),


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to