1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

add example for Socket.gethostbyaddr.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2017-10-21 12:22:46 +00:00
parent 6d2dc71acb
commit 6fba455acb

View file

@ -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)