diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/socket/ancdata.c | 2 | ||||
-rw-r--r-- | ext/socket/basicsocket.c | 2 | ||||
-rw-r--r-- | ext/socket/ipsocket.c | 2 | ||||
-rw-r--r-- | ext/socket/option.c | 2 | ||||
-rw-r--r-- | ext/socket/socket.c | 2 | ||||
-rw-r--r-- | ext/socket/udpsocket.c | 2 | ||||
-rw-r--r-- | ext/socket/unixserver.c | 2 | ||||
-rw-r--r-- | ext/socket/unixsocket.c | 2 |
8 files changed, 16 insertions, 0 deletions
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c index 02766ba5d2..f5451c9569 100644 --- a/ext/socket/ancdata.c +++ b/ext/socket/ancdata.c @@ -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> */ diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c index 2d2b22e1a9..ee967c7b7a 100644 --- a/ext/socket/basicsocket.c +++ b/ext/socket/basicsocket.c @@ -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 diff --git a/ext/socket/ipsocket.c b/ext/socket/ipsocket.c index 9981fd43ad..dbf403b39a 100644 --- a/ext/socket/ipsocket.c +++ b/ext/socket/ipsocket.c @@ -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" * diff --git a/ext/socket/option.c b/ext/socket/option.c index 4c75fe046d..bf3af171a2 100644 --- a/ext/socket/option.c +++ b/ext/socket/option.c @@ -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> * diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 542cd02ed6..14e069bb8d 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -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') * diff --git a/ext/socket/udpsocket.c b/ext/socket/udpsocket.c index 7b7b34f04d..c2e273c2a3 100644 --- a/ext/socket/udpsocket.c +++ b/ext/socket/udpsocket.c @@ -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> * diff --git a/ext/socket/unixserver.c b/ext/socket/unixserver.c index 799dcffb00..b1f2a38547 100644 --- a/ext/socket/unixserver.c +++ b/ext/socket/unixserver.c @@ -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 diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c index d1cf1e2b2a..5a44b552f8 100644 --- a/ext/socket/unixsocket.c +++ b/ext/socket/unixsocket.c @@ -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 * |