[前][次][番号順一覧][スレッド一覧]

ruby-changes:48146

From: akr <ko1@a...>
Date: Sat, 21 Oct 2017 21:22:50 +0900 (JST)
Subject: [ruby-changes:48146] akr:r60260 (trunk): add example for Socket.gethostbyaddr.

akr	2017-10-21 21:22:46 +0900 (Sat, 21 Oct 2017)

  New Revision: 60260

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60260

  Log:
    add example for Socket.gethostbyaddr.

  Modified files:
    trunk/ext/socket/socket.c
Index: ext/socket/socket.c
===================================================================
--- ext/socket/socket.c	(revision 60259)
+++ ext/socket/socket.c	(revision 60260)
@@ -1004,6 +1004,13 @@ sock_s_gethostbyname(VALUE obj, VALUE ho https://github.com/ruby/ruby/blob/trunk/ext/socket/socket.c#L1004
  *
  *   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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]