access to xml_rpc server problem

Steve Holden steve at holdenweb.com
Thu Sep 21 18:20:34 CEST 2006


Ted Zeng wrote:
> HI,
> 
> I run a xml_rpc server like the following:(sample code from internet)
> 
> server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8000))
> server.serve_forever()
> 
> If my client is on the same machine, I use :(also from internet sample
> code)
> 
> server = xmlrpclib.Server('http://localhost:8000')
> print server.chop_in_half('I am a confidant guy')
> 
> This works fine.
> 
> But if I use server's ip address instead of localhost in the client,
> then it could not access the server.
> 
> server = xmlrpclib.Server('http://machine_ip_address:8000')
> print server.chop_in_half('I am a confidant guy')
> 
> 
> How can my client (runs on other machine) access the server? The server
> runs on a machine with dynamic IP. But my client knows the IP address.
>  

You are explicitly telling your server ONLY to listen on the loopback 
interface. Try using an empty string as IP address instead:

server = SimpleXMLRPCServer.SimpleXMLRPCServer(("", 8000))

That will tell it to listen on all interfaces:

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list