mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* backport r32977 from trunk
* ext/socket: Make Socket documentation appear. Add documentation for Socket, TCPServer, SOCKSSocket. Patch by Sylvain Daubert. [Ruby 1.9 - Feature #5182] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@32979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
28d8d87812
commit
82322e5d4b
16 changed files with 253 additions and 103 deletions
|
@ -55,14 +55,27 @@ tcp_s_gethostbyname(VALUE obj, VALUE host)
|
|||
tcp_sockaddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Document-class: ::TCPSocket < IPSocket
|
||||
*
|
||||
* TCPSocket represents a TCP/IP client socket.
|
||||
*/
|
||||
void
|
||||
rsock_init_tcpsocket(void)
|
||||
{
|
||||
/*
|
||||
* Document-class: TCPSocket < IPSocket
|
||||
*
|
||||
* TCPSocket represents a TCP/IP client socket.
|
||||
*
|
||||
* A simple client may look like:
|
||||
*
|
||||
* require 'socket'
|
||||
*
|
||||
* s = TCPSocket.new 'localhost', 2000
|
||||
*
|
||||
* while line = s.gets # Read lines from socket
|
||||
* puts line # and print them
|
||||
* end
|
||||
*
|
||||
* s.close # close socket when done
|
||||
*
|
||||
*/
|
||||
rb_cTCPSocket = rb_define_class("TCPSocket", rb_cIPSocket);
|
||||
rb_define_singleton_method(rb_cTCPSocket, "gethostbyname", tcp_s_gethostbyname, 1);
|
||||
rb_define_method(rb_cTCPSocket, "initialize", tcp_init, -1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue