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

ruby-changes:15132

From: akr <ko1@a...>
Date: Mon, 22 Mar 2010 12:35:46 +0900 (JST)
Subject: [ruby-changes:15132] Ruby:r27009 (trunk): update doc.

akr	2010-03-22 12:33:14 +0900 (Mon, 22 Mar 2010)

  New Revision: 27009

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27009

  Log:
    update doc.

  Modified files:
    trunk/ext/socket/basicsocket.c
    trunk/ext/socket/ipsocket.c
    trunk/ext/socket/socket.c
    trunk/lib/resolv-replace.rb

Index: lib/resolv-replace.rb
===================================================================
--- lib/resolv-replace.rb	(revision 27008)
+++ lib/resolv-replace.rb	(revision 27009)
@@ -2,7 +2,9 @@
 require 'resolv'
 
 class << IPSocket
+  # :stopdoc:
   alias original_resolv_getaddress getaddress
+  # :startdoc:
   def getaddress(host)
     begin
       return Resolv.getaddress(host).to_s
@@ -13,7 +15,9 @@
 end
 
 class TCPSocket < IPSocket
+  # :stopdoc:
   alias original_resolv_initialize initialize
+  # :startdoc:
   def initialize(host, serv, *rest)
     rest[0] = IPSocket.getaddress(rest[0]) unless rest.empty?
     original_resolv_initialize(IPSocket.getaddress(host), serv, *rest)
@@ -21,18 +25,24 @@
 end
 
 class UDPSocket < IPSocket
+  # :stopdoc:
   alias original_resolv_bind bind
+  # :startdoc:
   def bind(host, port)
     host = IPSocket.getaddress(host) if host != ""
     original_resolv_bind(host, port)
   end
 
+  # :stopdoc:
   alias original_resolv_connect connect
+  # :startdoc:
   def connect(host, port)
     original_resolv_connect(IPSocket.getaddress(host), port)
   end
 
+  # :stopdoc:
   alias original_resolv_send send
+  # :startdoc:
   def send(mesg, flags, *rest)
     if rest.length == 2
       host, port = rest
@@ -56,7 +66,9 @@
 end
 
 class SOCKSSocket < TCPSocket
+  # :stopdoc:
   alias original_resolv_initialize initialize
+  # :startdoc:
   def initialize(host, serv)
     original_resolv_initialize(IPSocket.getaddress(host), port)
   end
Index: ext/socket/ipsocket.c
===================================================================
--- ext/socket/ipsocket.c	(revision 27008)
+++ ext/socket/ipsocket.c	(revision 27009)
@@ -264,7 +264,7 @@
  * call-seq:
  *   IPSocket.getaddress(host)        => ipaddress
  *
- * Lookups IP address of _host_.
+ * Lookups the IP address of _host_.
  *
  *   IPSocket.getaddress("localhost")     #=> "127.0.0.1"
  *   IPSocket.getaddress("ip6-localhost") #=> "::1"
Index: ext/socket/socket.c
===================================================================
--- ext/socket/socket.c	(revision 27008)
+++ ext/socket/socket.c	(revision 27009)
@@ -1097,6 +1097,8 @@
  *   +true+, +:hostname+:  hostname is obtained from numeric address using reverse lookup, which may take a time.
  *   +false+, +:numeric+:  hostname is same as numeric address.
  *   +nil+:              obey to the current +do_not_reverse_lookup+ flag.
+ *
+ * If Addrinfo object is preferred, use Addrinfo.getaddrinfo.
  */
 static VALUE
 sock_s_getaddrinfo(int argc, VALUE *argv)
@@ -1147,6 +1149,8 @@
  *   Socket.getnameinfo(Socket.sockaddr_in(80, "127.0.0.1"))       #=> ["localhost", "www"]
  *   Socket.getnameinfo(["AF_INET", 80, "127.0.0.1"])              #=> ["localhost", "www"]
  *   Socket.getnameinfo(["AF_INET", 80, "localhost", "127.0.0.1"]) #=> ["localhost", "www"]
+ *
+ * If Addrinfo object is preferred, use Addrinfo#getnameinfo.
  */
 static VALUE
 sock_s_getnameinfo(int argc, VALUE *argv)
@@ -1798,6 +1802,15 @@
  * information on particular exception is needed please refer to the 
  * Unix manual pages or the Windows WinSock reference.
  * 
+ * === Convenient methods
+ *
+ * Although the general way to create socket is Socket.new,
+ * there are several methods for socket creation for most cases.
+ *
+ * * TCP client socket: Socket.tcp, TCPSocket.open
+ * * TCP server socket: Socket.tcp_server_loop, TCPServer.open
+ * * UNIX client socket: Socket.unix, UNIXSocket.open
+ * * UNIX server socket: Socket.unix_server_loop, UNIXServer.open
  * 
  * === Documentation by
  * * Zach Dennis
Index: ext/socket/basicsocket.c
===================================================================
--- ext/socket/basicsocket.c	(revision 27008)
+++ ext/socket/basicsocket.c	(revision 27009)
@@ -348,6 +348,8 @@
  *   TCPServer.open("127.0.0.1", 15120) {|serv|
  *     p serv.getsockname #=> "\x02\x00;\x10\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
  *   }
+ *
+ * If Addrinfo object is preferred, use BasicSocket#local_address.
  */
 static VALUE
 bsock_getsockname(VALUE sock)
@@ -374,6 +376,8 @@
  *     p s.getpeername #=> "\x02\x00\x82u\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
  *   }
  *
+ * If Addrinfo object is preferred, use BasicSocket#remote_address.
+ *
  */
 static VALUE
 bsock_getpeername(VALUE sock)

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

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