Skip to content

Commit 6fba455

Browse files
committed
add example for Socket.gethostbyaddr.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 6d2dc71 commit 6fba455

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ext/socket/socket.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,13 @@ sock_s_gethostbyname(VALUE obj, VALUE host)
10041004
*
10051005
* p Socket.gethostbyaddr([221,186,184,68].pack("CCCC"))
10061006
* #=> ["carbon.ruby-lang.org", [], 2, "\xDD\xBA\xB8D"]
1007+
*
1008+
* p Socket.gethostbyaddr([127,0,0,1].pack("CCCC"))
1009+
* ["localhost", [], 2, "\x7F\x00\x00\x01"]
1010+
* p Socket.gethostbyaddr(([0]*15+[1]).pack("C"*16))
1011+
* #=> ["localhost", ["ip6-localhost", "ip6-loopback"], 10,
1012+
* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"]
1013+
*
10071014
*/
10081015
static VALUE
10091016
sock_s_gethostbyaddr(int argc, VALUE *argv)

0 commit comments

Comments
 (0)