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. Neighborly’s 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 `<main>': 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.

...

require "socket" myserver = TCPserver.new('localhost', 0)

It's TCPServer not TCPserver - note capital "S"

Dan Nachbar

Ruby is case sensitive.

Try with TCPServer…

-Jazmin

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.

Thanks Jazmin and Dan. That was the issue.