XML-RPC connection failed

Dear Ruby Experts,

I’m quite new to Ruby and was glad to be able to use this fantastic
language for writing short scripts. I use ruby to provide several hosts
with a special service using XML-RPC. The connection works well as long as
client and server run on the same host. The connection fails if the
connection request comes from a distant host.

My server is set up with:

require “xmlrpc/server”

server = XMLRPC::Server.new(6670)
server.add_handler(“xaiServer”, RPCHandler.new)
server.serve

as it was written in the XML-RPC example. The client connect with

require “xmlrpc/client”

xaiServer = XMLRPC::Client.new(“localhost”, “/RPC2”, 6670,
nil, nil, nil, nil, false, 10)

If I change “localhost” to my IP address or full qualified host name, the
client terminates with this messages:

/usr/lib/ruby/1.6/net/protocol.rb:343:in new': Connection refused - "connect(2)" (Errno::ECONNREFUSED) from /usr/lib/ruby/1.6/net/protocol.rb:343:inconnect’
from /usr/lib/ruby/1.6/net/protocol.rb:342:in timeout' from /usr/lib/ruby/1.6/net/protocol.rb:342:inconnect’
from /usr/lib/ruby/1.6/net/protocol.rb:329:in initialize' from /usr/lib/ruby/1.6/net/protocol.rb:107:innew’
from /usr/lib/ruby/1.6/net/protocol.rb:107:in conn_socket' from /usr/lib/ruby/1.6/net/http.rb:360:indo_start’
from /usr/lib/ruby/1.6/net/protocol.rb:93:in start' from /usr/lib/ruby/1.6/net/http.rb:490:inrequest’
from /usr/lib/ruby/1.6/net/http.rb:473:in request_post' from /usr/lib/ruby/1.6/xmlrpc/client.rb:488:indo_rpc’
from /usr/lib/ruby/1.6/xmlrpc/client.rb:382:in call2' from /usr/lib/ruby/1.6/xmlrpc/client.rb:372:incall’
from ./getPresentations:35

If I use only the hostname (my system is able to resolve its hostname), I
get a timeout error:

/usr/lib/ruby/1.6/timeout.rb:35:in `connect’: execution expired
(TimeoutError)

Any advice?

Yours,
Rene

Rene Tschirley wrote:

I’m quite new to Ruby and was glad to be able to use this fantastic
language for writing short scripts. I use ruby to provide several hosts
with a special service using XML-RPC. The connection works well as long as
client and server run on the same host. The connection fails if the
connection request comes from a distant host.

My server is set up with:

require “xmlrpc/server”

server = XMLRPC::Server.new(6670)

Try setting the server hostname or IP when you create the server. The
default is 127.0.0.1 a.k.a. localhost. Listening only on the loopback
device means you aren’t listening on the network.

http://www.fantasy-coders.de/ruby/xmlrpc4r/server.html

···


([ Kent Dahl ]/)_ ~ [ http://www.stud.ntnu.no/~kentda/ ]/~
))_student
/(( _d L b_/ NTNU - graduate engineering - 5. year )
( __õ|õ// ) )Industrial economics and technological management(
_
/ö____/ (_engineering.discipline=Computer::Technology)