summaryrefslogtreecommitdiff
path: root/ext/socket/socket.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 12:22:46 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 12:22:46 +0000
commit6fba455acbac14d1e5f0e789b8a74101fe060514 (patch)
tree85dd6e4900d86ff28131b3e15b5c709423a3d420 /ext/socket/socket.c
parent6d2dc71acbe6065c22241ecf8a9ddb2699bd5b61 (diff)
add example for Socket.gethostbyaddr.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r--ext/socket/socket.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 9eb36de..b6230bc 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)