Wednesday, April 4, 2007

getaddrinfo: name or service not known

Once again I find myself trying to get a ruby app working on a windows machine. I can hardly express bad I feel for anyone who is plagued to work in such an environment full time. The last time I was struggling to understand how Ruby's in-process threads on win32 are not concurrent. This time around it's trying to understand why getaddrinfo() was failing.

Basically I'm working with DRb which by default uses TCPSocket as the default protocol. Socket.getaddrinfo() was telling me 'name or service not known' when it was trying to connect to the DRb server on my unix host. After hours of googling around learning about getaddrinfo() on windows and cygwin I came to realize that my problem was probably not related to what most of the google (and yahoo) results were returning. Apparently there was a time when that call would simply fail or was not implemented in cygwin. It turned out my problem was actually related to the hostname of the machine it was working on: 'LENOVO-A0EFF48'. I can't say I totally understand the relationship between cygwin and windows understand of a machine's hostname but I eventually changed the hostname to 'localhost'. I rebooted I got a different error because my VPN was choking (and I suspected it to be related to the hostname change). I then changed the hostname to 'laptop' and rebooted. Voila, my VPN and getaddrinfo() worked. Now I think I'm back to fighting Ruby threading issues on windows.

When I get around to it I'll look microsoft's getaddrinfo() source and figure out why it was choking on 'LENOVO-A0EFF48', oh wait....

No comments:


my google reader feed