TCPServer in 1.9.2

Hi. First post in this group and I hope someone can help.

I am trying to teach myself Ruby with a long-term goal of doing some
web development using Ruby on Rails.

Note: version
C:\rails\hello>ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]

I have been going through Jeremy McAnally’s book “Mr. Neighborlys
Humble Little Ruby Book” and there is a section in chapter 5 where he
explains how to connect a socket using the lines:

require “socket”
myserver = TCPserver.new(‘localhost’, 0)

When I try this I get the error:

C:\rails\hello>ruby server.rb
server.rb:2:in `': uninitialized constant Object::TCPserver
(NameError)

So I look in the socket.rb file and sure enough there is no TCPserver
class although all of the documentation I find online says there
should be. I even went to Downloads to get
ruby and install again and still no luck.

Is this a deprecated class? Is there some other way to make a socket
connection? Is there somewhere that I can get the version of socket
that contains this class?

Thank you.

Ruby is case sensitive.

Try with TCPServer…

-Jazmin

On Thu, Sep 8, 2011 at 1:48 PM, zxcv [email protected] wrote:

Humble Little Ruby Book" and there is a section in chapter 5 where he


You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


Jazmin

On Sep 8, 2:48pm, zxcv [email protected] wrote:

require “socket”
myserver = TCPserver.new(‘localhost’, 0)

It’s TCPServer not TCPserver - note capital “S”

Dan N.

On Sep 8, 6:02pm, Dan [email protected] wrote:

Dan N.
Thanks Jazmin and Dan. That was the issue.

Spelled it correctly in the title. A good hint as to what was wrong:

Object::TCPserver (NameError)

Sometimes, if you know your code is right, but it still won’t work,
delete the offending line and retype it.