From 1561d3fb8b2eb8bfeaabd1d05ff0870b285feb4e Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 22 Mar 2010 03:33:14 +0000 Subject: update doc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/socket/basicsocket.c | 4 ++++ ext/socket/ipsocket.c | 2 +- ext/socket/socket.c | 13 +++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) (limited to 'ext') diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c index 440eb76e2e..5e28bcf956 100644 --- a/ext/socket/basicsocket.c +++ b/ext/socket/basicsocket.c @@ -348,6 +348,8 @@ bsock_getsockopt(VALUE sock, VALUE lev, VALUE optname) * 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 @@ bsock_getsockname(VALUE sock) * 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) diff --git a/ext/socket/ipsocket.c b/ext/socket/ipsocket.c index 03e6b4518e..ad1ac231c3 100644 --- a/ext/socket/ipsocket.c +++ b/ext/socket/ipsocket.c @@ -264,7 +264,7 @@ ip_recvfrom(int argc, VALUE *argv, VALUE sock) * 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" diff --git a/ext/socket/socket.c b/ext/socket/socket.c index b9192285c2..1b026a6741 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -1097,6 +1097,8 @@ sock_s_getservbyport(int argc, VALUE *argv) * +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 @@ sock_s_getaddrinfo(int argc, VALUE *argv) * 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 @@ socket_s_ip_address_list(VALUE self) * 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 -- cgit v1.2.3