On Thursday 08 December 2005 19:42, Eric Hodel wrote:
> On Dec 8, 2005, at 7:51 AM, Kevin Brown wrote:
> > On Wednesday 07 December 2005 18:13, Eric Hodel wrote:
> >> [...]
> Maybe try:
>
> 127.0.0.1 localhost.localdomain localhost
> 192.168.2.105 costarica.fylz.com costarica
> 192.168.2.102 nicaragua.fylz.com nicaragua
>
> in your /etc/hosts.

That is exactly the content of both /etc/hosts files (with some ipv6 stuff and 
a few other machines).

== Server ==
kevin@costarica:~/drbsample$ ruby dchats.rb
druby://costarica.fylz.com:1255
[return] to exit.

== Client ==
kevin@nicaragua:~/ruby/drb$ ruby dchatc.rb druby://costarica.fylz.com:1255 
kevin
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:733:in `open': 
druby://nicaragua.fylz.com:34220 - #<Errno::ECONNREFUSED: Connection refused 
- connect(2)> (DRb::DRbConnError)
        from 
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:726:in `each'
        from 
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:726:in `open'
        from 
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:1185:in 
`initialize'
        from 
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:1165:in `new'
        from 
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:1165:in `open'
        from 
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:1082:in 
`method_missing'
        from 
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:1081:in 
`with_friend'
        from 
(druby://costarica.fylz.com:1255) /usr/lib/ruby/1.8/drb/drb.rb:1081:in 
`method_missing'
        from (druby://costarica.fylz.com:1255) dchats.rb:14:in `initialize'
        from (druby://costarica.fylz.com:1255) dchats.rb:37:in `new'
        from (druby://costarica.fylz.com:1255) dchats.rb:37:in `add_member'
        from dchatc.rb:37


This is why I was whining so heavily a month or so ago.  I can connect to the 
postgres server on this machine with no problems....  Is there any reason 
that DRb needs to use hostnames?

Anyway, now with the /etc/hosts modifications, here's the same 5 commands on 
both:

== Server ==
kevin@costarica:~/drbsample$ ruby -rsocket -e 'p Socket.gethostname'
"costarica.fylz.com"

kevin@costarica:~/drbsample$ ruby -rsocket -e 'p 
Socket.gethostbyname("costarica.fylz.com")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

kevin@costarica:~/drbsample$ ruby -rsocket -e 'p 
Socket.gethostbyaddr("\300\250\002i")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

kevin@costarica:~/drbsample$ ruby -rsocket -e 'p 
Socket.gethostbyname("nicaragua.fylz.com")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

kevin@costarica:~/drbsample$ ruby -rsocket -e 'p 
Socket.gethostbyaddr("\300\250\002f")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

== Client ==
kevin@nicaragua:~/ruby/drb$ ruby -rsocket -e 'p Socket.gethostname'
"nicaragua"

kevin@nicaragua:~/ruby/drb$ cat /etc/hosts
127.0.0.1       localhost.localdomain   localhost

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

192.168.2.105 costarica.fylz.com costarica
192.168.2.102 nicaragua.fylz.com nicaragua

kevin@nicaragua:~/ruby/drb$ hostname
nicaragua
kevin@nicaragua:~/ruby/drb$ sudo hostname nicaragua.fylz.com
Password:
kevin@nicaragua:~/ruby/drb$ hostname
nicaragua.fylz.com
kevin@nicaragua:~/ruby/drb$ ruby -rsocket -e 'p Socket.gethostname'
"nicaragua.fylz.com"

So.....what the heck here....?

kevin@nicaragua:~/ruby/drb$  ruby -rsocket -e 'p 
Socket.gethostbyname("nicaragua.fylz.com")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

kevin@nicaragua:~/ruby/drb$ ruby -rsocket -e 'p 
Socket.gethostbyaddr("\300\250\002f")'
["nicaragua.fylz.com", ["nicaragua"], 2, "\300\250\002f"]

kevin@nicaragua:~/ruby/drb$ ruby -rsocket -e 'p 
Socket.gethostbyname("costarica.fylz.com")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

kevin@nicaragua:~/ruby/drb$ ruby -rsocket -e 'p 
Socket.gethostbyaddr("\300\250\002i")'
["costarica.fylz.com", ["costarica"], 2, "\300\250\002i"]

But still...
kevin@costarica:~/drbsample$ ruby dchats.rb
druby://costarica.fylz.com:1257
[return] to exit.

(By the way, while that's running)
kevin@costarica:~$ netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:8000                  *:*                     LISTEN
tcp        0      0 *:1257                  *:*                     LISTEN

And I obviously talk:
kevin@nicaragua:~$ telnet costarica.fylz.com 1257
Trying 192.168.2.105...
Connected to costarica.fylz.com.
Escape character is '^]'.
asdf
o:DRb::DRbConnError:bt["//usr/lib/ruby/1.8/drb/drb.rb:570:in 
`load'"7/usr/lib/ruby/1.8/drb/drb.rb:609:in 
`recv_request'"7/usr/lib/ruby/1.8/drb/drb.rb:908:in 
`recv_request'"</usr/lib/ruby/1.8/drb/drb.rb:1527:in 
`init_with_client'"9/usr/lib/ruby/1.8/drb/drb.rb:1539:in 
`setup_message'"3/usr/lib/ruby/1.8/drb/drb.rb:1491:in 
`perform'"5/usr/lib/ruby/1.8/drb/drb.rb:1586:in 
`main_loop'"0/usr/lib/ruby/1.8/drb/drb.rb:1582:in 
`loop'"5/usr/lib/ruby/1.8/drb/drb.rb:1582:in 
`main_loop'"1/usr/lib/ruby/1.8/drb/drb.rb:1578:in 
`start'"5/usr/lib/ruby/1.8/drb/drb.rb:1578:in 
`main_loop'"//usr/lib/ruby/1.8/drb/drb.rb:1426:in 
`run'"1/usr/lib/ruby/1.8/drb/drb.rb:1423:in 
`start'"//usr/lib/ruby/1.8/drb/drb.rb:1423:in 
`run'"6/usr/lib/ruby/1.8/drb/drb.rb:1343:in 
`initialize'"//usr/lib/ruby/1.8/drb/drb.rb:1624:in 
`new'"9/usr/lib/ruby/1.8/drb/drb.rb:1624:in `start_service'"dchats.rb:67:    
mesg" too large packet 1634952294Connection closed by foreign host.

But:
kevin@nicaragua:~/ruby/drb$ ruby dchatc.rb druby://costarica.fylz.com:1257 
kevin
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:733:in `open': 
druby://nicaragua.fylz.com:34246 - #<Errno::ECONNREFUSED: Connection refused 
- connect(2)> (DRb::DRbConnError)
        from 
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:726:in `each'
        from 
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:726:in `open'
        from 
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:1185:in 
`initialize'
        from 
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:1165:in `new'
        from 
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:1165:in `open'
        from 
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:1082:in 
`method_missing'
        from 
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:1081:in 
`with_friend'
        from 
(druby://costarica.fylz.com:1257) /usr/lib/ruby/1.8/drb/drb.rb:1081:in 
`method_missing'
        from (druby://costarica.fylz.com:1257) dchats.rb:14:in `initialize'
        from (druby://costarica.fylz.com:1257) dchats.rb:37:in `new'
        from (druby://costarica.fylz.com:1257) dchats.rb:37:in `add_member'
        from dchatc.rb:37

I'm at a loss.