Hi,

I'm kindof new to ruby, and I'm trying to figure out some networking
stuff for ruby, but I keep getting "Errno::ECONNREFUSED". I am on
Windows 7, and I'm just using the cmd prompt to run my code. I disabled
my firewall and run it, but that didn't work. Any suggestions?

This is what happens when I run my code:
--------------------------------------
$- ruby serverexample.rb
serverexample.rb:5:in `initialize': No connection could be made because
the targ
et machine actively refused it. - connect(2) (Errno::ECONNREFUSED)
        from serverexample.rb:5:in `open'
        from serverexample.rb:5:in `<main>'
----------------------------------------


Here is a copy of serverexample.rb (which I got from
http://www.tutorialspoint.com/ruby/ruby_socket_programming.htm)

----------------------------
require 'socket'

hostname = 'localhost'
port = 2000
s = TCPSocket.open(hostname, port)

while line = s.gets
  puts line.chomp
end
s.close
---------------------------------


Thank you for the help.

-- 
Posted via http://www.ruby-forum.com/.