From: Dave Thomas Date: 2001-02-04T05:16:45+09:00 Subject: [ruby-talk:10319] Re: TCPServer - bug in documentation ? Michael Neumann writes: > It seems to be, that there's either an bug in TCPServer, or > the description in "Programming Ruby" is wrong. I'd always assume the latter ;-) > > The book says about TCPServer.new, that if a host is omitted, it > will listen on *all* interfaces (equivalent to "0.0.0.0"). That's very strange, because on my box > But that's not the case. > > I tried following code: > require "socket" > s = TCPServer.new(8080) > s.accept > > Then 'telnet 192.168.1.1 8080' and got a "Connection refused". > (192.168.1.1 is my local IP-adress) But 'telnet localhost 8080' > works!!! (where localhost is 127.0.0.1) dave[ext/socket 14:11:50] ruby -v -e'p RUBY_PLATFORM' ruby 1.6.2 (2001-02-02) [i686-linux] "i686-linux" dave[ext/socket 14:13:10] ruby -r socket -e 's=TCPServer.new(5678);loop{s.accept}'& dave[ext/socket 14:13:48] telnet localhost 5678 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. ^] telnet> Connection closed. dave[ext/socket 14:14:02] telnet zip.local.thomases.com 5678 Trying 10.96.0.14... Connected to zip.local.thomases.com. Escape character is '^]'. ^] telnet> Connection closed. So, we seem to have some kind of different behavior between us. That's interesting, because Guy and I are also experiencing a different in TCP behavior. I'm wondering if this might be a libc issue? Anyone with networking experience any ideas? Dave