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 http://rubyinstaller.org/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. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 8, 2:48 pm, zxcv <zxcvnos...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote: ...> > require "socket" > myserver = TCPserver.new(''localhost'', 0) >It''s TCPServer not TCPserver - note capital "S" Dan Nachbar -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ruby is case sensitive. Try with TCPServer.. -Jazmin On Thu, Sep 8, 2011 at 1:48 PM, zxcv <zxcvnosend-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> 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 http://rubyinstaller.org/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. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- Jazmin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 8, 6:02 pm, Dan <daniel.nach...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sep 8, 2:48 pm, zxcv <zxcvnos...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote: > ... > > > > > require "socket" > > myserver = TCPserver.new(''localhost'', 0) > > It''s TCPServer not TCPserver - note capital "S" > > Dan NachbarThanks Jazmin and Dan. That was the issue. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.