Project

General

Profile

Actions

Bug #6732

closed

documentation error in IPSocket#peeraddr

Added by JWuttke (Joachim Wuttke) over 12 years ago. Updated almost 12 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
Backport:
[ruby-core:46429]

Description

ri1.9.3 IPSocket#peeraddr
says
TCPSocket.open("www.ruby-lang.org", 80) {|sock|
p sock.peeraddr #=> ["AF_INET", 80, "carbon.ruby-lang.org", "221.186.184.68"]
p sock.peeraddr(true) #=> ["AF_INET", 80, "221.186.184.68", "221.186.184.68"]
p sock.peeraddr(false) #=> ["AF_INET", 80, "221.186.184.68", "221.186.184.68"]
p sock.peeraddr(:hostname) #=> ["AF_INET", 80, "carbon.ruby-lang.org", "221.186.184.68"]
p sock.peeraddr(:numeric) #=> ["AF_INET", 80, "221.186.184.68", "221.186.184.68"]
}
the third line is wrong: peeraddr(true) actually returns the same as peeraddr(:hostname)

Actions

Also available in: Atom PDF

Like0
Like0Like0