Where is the .rb for sockets?

J

John Maclean

Normally I use `ri foo` whenever I want to read up on something. There's
also the ruby library, (/usr/lib/ruby/1.8), as there are some goodies and clues in the comments. `locate foo.rb` normally does it but in the case for TCPSocket, Socket and IPSocket there's nothing to be found. Where is it hidden?

Socket.ancestors
[Socket, BasicSocket, IO, File::Constants, Enumerable, Object, PP::ObjectMixin, Kernel]

I'm guessing that it's either part of IO or something writen in C. Am I
right? Is there a Socket.rb file anywhere?

- jjm
 
J

Joel VanderWerf

John said:
Normally I use `ri foo` whenever I want to read up on something. There's
also the ruby library, (/usr/lib/ruby/1.8), as there are some goodies and clues in the comments. `locate foo.rb` normally does it but in the case for TCPSocket, Socket and IPSocket there's nothing to be found. Where is it hidden?

Socket.ancestors
[Socket, BasicSocket, IO, File::Constants, Enumerable, Object, PP::ObjectMixin, Kernel]

I'm guessing that it's either part of IO or something writen in C. Am I
right? Is there a Socket.rb file anywhere?

Socket lib is written in C, but there are ri docs for it:


$ ri Socket | head -n 20
---------------------------------------------------------- Class: Socket
Class Socket provides access to the underlying operating system
socket implementations. It can be used to provide more operating
system specific functionality than the protocol-specific socket
classes but at the expense of greater complexity. In particular,
the class handles addresses using +struct sockaddr+ structures
packed into Ruby strings, which can be a joy to manipulate.

Exception Handling
Ruby's implementation of Socket causes an exception to be raised
based on the error generated by the system dependent
implementation. This is why the methods are documented in a way
that isolate Unix-based system exceptions from Windows based
exceptions. If more information on particular exception is needed
please refer to the Unix manual pages or the Windows WinSock
reference.

Documentation by
* Zach Dennis


Does this work on your system?

Not all of the methods have docs, tho.
 
J

John Maclean

John said:
Normally I use `ri foo` whenever I want to read up on something.
There's also the ruby library, (/usr/lib/ruby/1.8), as there are
some goodies and clues in the comments. `locate foo.rb` normally
does it but in the case for TCPSocket, Socket and IPSocket there's
nothing to be found. Where is it hidden?

Socket.ancestors
[Socket, BasicSocket, IO, File::Constants, Enumerable, Object,
PP::ObjectMixin, Kernel]

I'm guessing that it's either part of IO or something writen in C.
Am I right? Is there a Socket.rb file anywhere?

Socket lib is written in C, but there are ri docs for it:


$ ri Socket | head -n 20
---------------------------------------------------------- Class:
Socket Class Socket provides access to the underlying operating system
socket implementations. It can be used to provide more operating
system specific functionality than the protocol-specific socket
classes but at the expense of greater complexity. In particular,
the class handles addresses using +struct sockaddr+ structures
packed into Ruby strings, which can be a joy to manipulate.

Exception Handling
Ruby's implementation of Socket causes an exception to be raised
based on the error generated by the system dependent
implementation. This is why the methods are documented in a way
that isolate Unix-based system exceptions from Windows based
exceptions. If more information on particular exception is
needed please refer to the Unix manual pages or the Windows WinSock
reference.

Documentation by
* Zach Dennis


Does this work on your system?

Not all of the methods have docs, tho.

yes that does work. I have those docs. where is the c code for io or tcp stuff? it it not this stuff...

/home/jayeola/bx/rb/ruby/1.8/io:
total used in directory 12 available 16697500
drwxr-xr-x 2 jayeola jayeola 4096 2008-06-27 03:30 .
drwxr-xr-x 31 jayeola jayeola 4096 2008-07-06 10:53 ..
-rw-r--r-- 1 jayeola jayeola 408 2008-06-27 03:30 nonblock.rb
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,797
Messages
2,569,647
Members
45,377
Latest member
Zebacus

Latest Threads

Top