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

* ext/socket/*.c: Add proper require for example to work.

[fix GH-1378][ci skip] Patch by @schneems

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2016-10-05 03:57:32 +00:00
parent 0d81bbcbbc
commit 4043565023
9 changed files with 21 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Wed Oct 5 12:57:21 2016 Richard Schneeman <richard.schneeman+foo@gmail.com>
* ext/socket/*.c: Add proper require for example to work.
[fix GH-1378][ci skip] Patch by @schneems
Wed Oct 5 11:47:19 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
* io.c: Fixed equivalent ruby code with core implemention.

View file

@ -360,6 +360,8 @@ ancillary_timestamp(VALUE self)
*
* The size and endian is dependent on the host.
*
* require 'socket'
*
* p Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, STDERR.fileno)
* #=> #<Socket::AncillaryData: UNIX SOCKET RIGHTS 2>
*/

View file

@ -565,6 +565,8 @@ rsock_bsock_send(int argc, VALUE *argv, VALUE sock)
*
* Gets the do_not_reverse_lookup flag of _basicsocket_.
*
* require 'socket'
*
* BasicSocket.do_not_reverse_lookup = false
* TCPSocket.open("www.ruby-lang.org", 80) {|sock|
* p sock.do_not_reverse_lookup #=> false

View file

@ -303,6 +303,8 @@ ip_recvfrom(int argc, VALUE *argv, VALUE sock)
*
* Lookups the IP address of _host_.
*
* require 'socket'
*
* IPSocket.getaddress("localhost") #=> "127.0.0.1"
* IPSocket.getaddress("ip6-localhost") #=> "::1"
*

View file

@ -272,6 +272,8 @@ sockopt_int(VALUE self)
* Creates a new Socket::Option object which contains boolean as data.
* Actually 0 or 1 as int is used.
*
* require 'socket'
*
* p Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, true)
* #=> #<Socket::Option: INET SOCKET KEEPALIVE 1>
*

View file

@ -1955,6 +1955,8 @@ Init_socket(void)
*
* Let's create an internet socket using the IPv4 protocol in a C-like manner:
*
* require 'socket'
*
* s = Socket.new Socket::AF_INET, Socket::SOCK_STREAM
* s.connect Socket.pack_sockaddr_in(80, 'example.com')
*

View file

@ -19,6 +19,8 @@
* _address_family_ should be an integer, a string or a symbol:
* Socket::AF_INET, "AF_INET", :INET, etc.
*
* require 'socket'
*
* UDPSocket.new #=> #<UDPSocket:fd 3>
* UDPSocket.new(Socket::AF_INET6) #=> #<UDPSocket:fd 4>
*

View file

@ -17,6 +17,8 @@
*
* Creates a new UNIX server socket bound to _path_.
*
* require 'socket'
*
* serv = UNIXServer.new("/tmp/sock")
* s = serv.accept
* p s.read

View file

@ -93,6 +93,8 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
*
* Creates a new UNIX client socket connected to _path_.
*
* require 'socket'
*
* s = UNIXSocket.new("/tmp/sock")
* s.send "hello", 0
*