[MacRuby-devel] connect to udp socket: getaddrinfo: nodename nor servname provided, or not known (SocketError)

Brian Marick marick at exampler.com
Fri Dec 11 08:05:30 PST 2009


I'm on Snow Leopard (10.6.2), using xmpp4r. I can connect to the jabber server fine using Apple's stock Ruby (1.8.7 (2008-08-11 patchlevel 72)) but not with MacRuby 0.5 (beta 2). When I try the same code with MacRuby, I get this:

core:in `connect:': getaddrinfo: nodename nor servname provided, or not known (SocketError)
	from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/1.9.0/resolv.rb:690:in `initialize:'

That line is from this code: 

      class ConnectedUDP < Requester # :nodoc:
        def initialize(host, port=Port)
          super()
          @host = host
          @port = port
==>          @sock = UDPSocket.new(host.index(':') ? Socket::AF_INET6 : Socket::AF_INET)
          DNS.bind_random_port(@sock)
          @sock.connect(host, port)
          @sock.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) if defined? Fcntl::F_SETFD
        end

That code is the same as in 1.8.7 (though there are other differences in the file). 

I searched around and found references to the same error message coming from using drb on 10.5.3 stock ruby, but notice that my stock Ruby works. 

I'll do a little more digging. Does anyone have any ideas? Here's the code:

http://pastie.org/739072

-----
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick



More information about the MacRuby-devel mailing list