From: Martin Portman Date: 2007-10-10T23:41:00+09:00 Subject: Re: Simple socket server not working? Stephen Ware wrote: > Any idea why this code... > > require 'socket' > server = TCPServer.new('127.0.0.1', 5056) > socket = server.accept > socket.puts('it works') > socket.flush > > doesn't work on my Unix server? If I run it in the background, I can > connect from the same machine using telnet and it works fine... but I > cannot connect from any remote machines. > > What am I missing? Using the machine's network address. Something like server = TCPServer.new( '111.222.111.2' , 5056) should do the trick. 127.0.0.1 is the loopback address, which (AFAIK) means that socket won't get anywhere near the outside network, it will all be handled internally. Hence you cannot connect to it from outside your unix server. Martin.