From: Joel VanderWerf Date: 2003-08-23T16:37:28+09:00 Subject: Re: Integrated Webserver? GOTOU Yuuzou wrote: > Hi, > > In message <3F4541D9.8060403@path.berkeley.edu>, > `Joel VanderWerf ' wrote: > >>Looks nice. I tried this example (with minor modifications) and got >> >>[2003-08-21 14:44:46] INFO WEBrick 1.3.1 >>[2003-08-21 14:44:46] INFO ruby 1.8.0 (2003-08-04) [i686-linux] >>[2003-08-21 14:44:47] WARN TCPServer Error: Address family not >>supported by protocol - socket(2) >> >>Could it be because I'm trying to run it inside a 192.* network? (Tried >>googling for that error message, but that didn't help much.) > > > If you want to run WEBrick only in IPv4 network, > :BindAddress option may be useful. > > s = HTTPServer.new( > :Port => 2000, > :DocumentRoot => Dir::pwd + "/htdocs", > :BindAddress => "0.0.0.0" > ) Well, that's some progress. Now the output is: [2003-08-23 00:30:24] INFO WEBrick 1.3.1 [2003-08-23 00:30:24] INFO ruby 1.8.0 (2003-08-04) [i686-linux] But the process does not stay around (according to `ps -Af | grep ruby`), and my browser can't connect to anything at the ports I tried (2000, 9000, 9123). I also tried :BindAddress => "192.168.1.3" That's the ip of my host. > I think the error may come from the incompatibility of > getaddrinfo. What result does the following one-liner > become? > > % ruby -r socket -ve 'p Socket::getaddrinfo(nil,2000, > Socket::AF_UNSPEC,Socket::SOCK_STREAM,0,Socket::AI_PASSIVE)' > $ ruby -r socket -ve 'p Socket::getaddrinfo(nil,2000,Socket::AF_UNSPEC,Socket::SOCK_STREAM,0,Socket::AI_PASSIVE)' ruby 1.8.0 (2003-08-04) [i686-linux] [["AF_INET6", 2000, "::", "::", 10, 1, 6], ["AF_INET", 2000, "0.0.0.0", "0.0.0.0", 2, 1, 6]]