getaddrinfo :: ?

C

Chris Morris

I'm tinkering around with Borges on my XP box and one of the first
things it tries to do out of the chute is:

server = WEBrick::HTTPServer.new(options)
server.listen('::', 7000)

The listen method inside WEBrick is:

def listen(address, port)
res = Socket::getaddrinfo(address, port,
Socket::AF_UNSPEC, # address family
Socket::SOCK_STREAM, # socket type
0, # protocol
Socket::AI_PASSIVE) # flag

I assume '::' is shorthand for something, localhost if I had to guess
... but Googling for :: doesn't work so I've no idea where to start
looking. This is raised as an error:

c:/ruby/lib/ruby/1.8/webrick/server.rb:77:in `getaddrinfo': getaddrinfo:
no addr
ess associated with hostname. (SocketError)
from c:/ruby/lib/ruby/1.8/webrick/server.rb:77:in `listen'
from C:/ruby/lib/ruby/site_ruby/1.8/Borges/WEBrick.rb:67:in `create'
from C:/ruby/lib/ruby/site_ruby/1.8/Borges/WEBrick.rb:77:in `start'
from C:/ruby/lib/ruby/site_ruby/1.8/Borges/WEBrick.rb:88

Can anyone help me here?
 
C

Chris Morris

Chris said:
I assume '::' is shorthand for something, localhost if I had to guess ...

I replaced the Borges/WEBrick.rb code with localhost and it gets past
getaddrinfo, but then fails on the TCPServer.new line:

def listen(address, port)
res = Socket::getaddrinfo(address, port,
Socket::AF_UNSPEC, # address family
Socket::SOCK_STREAM, # socket type
0, # protocol
Socket::AI_PASSIVE) # flag
last_error = nil
sockets = []
res.each{|ai|
begin
@logger.debug("TCPServer.new(#{ai[3]}, #{ai[1]})")
sock = TCPServer.new(ai[3], ai[1])
Utils::set_close_on_exec(sock)
sockets << sock
rescue => ex
@logger.warn("TCPServer Error: #{ex}")
last_error = ex
end
}
raise last_error if sockets.empty?
return sockets
end

with the following:

c:/ruby/lib/ruby/1.8/webrick/server.rb:91:in `listen': Unknown Error -
bind(2) (
Errno::E048)
from C:/ruby/lib/ruby/site_ruby/1.8/Borges/WEBrick.rb:67:in `create'
from C:/ruby/lib/ruby/site_ruby/1.8/Borges/WEBrick.rb:77:in `start'
from C:/ruby/lib/ruby/site_ruby/1.8/Borges/WEBrick.rb:88
 
C

Chris Morris

Chris said:
I replaced the Borges/WEBrick.rb code with localhost and it gets past
getaddrinfo, but then fails on the TCPServer.new line:

I'm guessing this is older Borges code with newer WEBrick code. This is
the failing Borges code:

server = WEBrick::HTTPServer.new(options)
server.listen('127.0.0.1', 7000)
server.mount("/borges", self, options)

The HTTPServer.new call itself sets up shop on TCP port 7000, so the
following listen call is failing because the port is already in use.
Remmed out the .listen line and now we're rolling.
 
E

Eric Hodel

--EqVOK5mkaJAMmtSx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Oh, ha! I lied, I fixed this _after_ alpha3 (about 5 minutes after) :(

Here's the patch:

CS file: /home/cvs/ruby/seaside2/Borges/lib/Borges/WEBrick.rb,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -F ^[ ]*\(class\|module\|def\) -r1.9 -r1.10
--- ruby/seaside2/Borges/lib/Borges/WEBrick.rb 2003/12/21 02:53:52 1.9
+++ ruby/seaside2/Borges/lib/Borges/WEBrick.rb 2003/12/22 04:05:49 1.10
@@ -60,11 +60,10 @@ def do_GET(req, res)
# and mounts the Borges::WEBrickServlet on /borges.
=20
def self.create(options)
- options[:BindAddress] ||=3D '0.0.0.0'
+ options[:BindAddress] ||=3D nil
options[:port] ||=3D 7000
=20
server =3D WEBrick::HTTPServer.new(options)
- server.listen('::', 7000)
server.mount("/borges", self, options)
=20
return server


--=20
Eric Hodel - (e-mail address removed) - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04


--EqVOK5mkaJAMmtSx
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQE/6UE1MypVHHlsnwQRAoTSAJwKUpJZL9AHcni8kB/y8SHs6rGbFwCdF+NC
wIHMcSmEghF3a4aRQfeTT50=
=ID7n
-----END PGP SIGNATURE-----

--EqVOK5mkaJAMmtSx--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top