From: max herrera Date: 2012-10-21T11:10:56+09:00 Subject: Re: Socket help, getting Errno::ECONNREFUSED Okay, fixed my previous problem. But my client is still giving me the ECONNREFUSED error. First I run this script, which seems to work fine: ---------- require 'socket' # Get sockets from stdlib server = TCPServer.open(9900) # Socket to listen on port 2000 loop { # Servers run forever client = server.accept # Wait for a client to connect client.puts(Time.now.ctime) # Send the time to the client client.puts "Closing the connection. Bye!" client.close # Disconnect from the client } --------------------- then I run the client in a different command prompt (with the server script still running) --------------------- require 'socket' # Sockets are in standard library hostname = 'localhost' port = 9900 s = TCPSocket.open(hostname, port) while line = s.gets # Read lines from the socket puts line.chop # And print with platform line terminator end s.close # Close the socket when done ---------------------------------- Sorry, if I'm spamming, but I would really like to get past this mental hurdle. And I'm just stuck :/ Thank you again for you help! -- Posted via http://www.ruby-forum.com/.