From 6fba455acbac14d1e5f0e789b8a74101fe060514 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 21 Oct 2017 12:22:46 +0000 Subject: [PATCH] add example for Socket.gethostbyaddr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/socket/socket.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 9eb36def14..b6230bc7e6 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -1004,6 +1004,13 @@ sock_s_gethostbyname(VALUE obj, VALUE host) * * p Socket.gethostbyaddr([221,186,184,68].pack("CCCC")) * #=> ["carbon.ruby-lang.org", [], 2, "\xDD\xBA\xB8D"] + * + * p Socket.gethostbyaddr([127,0,0,1].pack("CCCC")) + * ["localhost", [], 2, "\x7F\x00\x00\x01"] + * p Socket.gethostbyaddr(([0]*15+[1]).pack("C"*16)) + * #=> ["localhost", ["ip6-localhost", "ip6-loopback"], 10, + * "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"] + * */ static VALUE sock_s_gethostbyaddr(int argc, VALUE *argv)