diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-21 12:22:46 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-21 12:22:46 +0000 |
commit | 6fba455acbac14d1e5f0e789b8a74101fe060514 (patch) | |
tree | 85dd6e4900d86ff28131b3e15b5c709423a3d420 | |
parent | 6d2dc71acbe6065c22241ecf8a9ddb2699bd5b61 (diff) | |
download | ruby-6fba455acbac14d1e5f0e789b8a74101fe060514.tar.gz |
add example for Socket.gethostbyaddr.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ext/socket/socket.c | 7 |
1 files changed, 7 insertions, 0 deletions
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) |