From: Thomas Lehmann on
Hi,

I'm wondering about the behavior. Running this example - it looks like
- that each rpc call is triggered in a visible interval (about one
second).

What's wrong?

Thomas

APPENDIX:

<code>
import threading
from xmlrpc.server import SimpleXMLRPCServer
import xmlrpc.client

class MyServer(threading.Thread):
def __init__(self, host, port):
threading.Thread.__init__(self)
self.server = SimpleXMLRPCServer((host, port))
self.server.register_function(self.is_even, "is_even")
self.server.register_function(self.stop, "stop_server")

def run(self):
print("server: waiting for requests...")
self.server.serve_forever()
print("server: is down.")

def stop(self):
print("server: shutdown requested...")
self.stoptimer = threading.Timer(1, self.server.shutdown)
self.stoptimer.start()
return "done."

def is_even(self, n):
print("server: check %d to be even" % (n))
return n%2 == 0


# server as thread
server = MyServer("localhost", 1234)
server.start()

# client code
serverProxy = xmlrpc.client.ServerProxy("http://localhost:1234")
for n in range(1,2+1):
print("%d is %s" % (n, ["odd", "even"][serverProxy.is_even(n)]))
serverProxy.stop_server()
</code>
From: Thomas Lehmann on
> What's wrong?
>

Obviously there's a problem with "localhost". When using the IP of my
machine everything is working fast.
From: Adam Tauno Williams on
On Thu, 2010-05-20 at 03:40 -0700, Thomas Lehmann wrote:
> > What's wrong?
> Obviously there's a problem with "localhost". When using the IP of my
> machine everything is working fast.

You box may first be trying to connect to ::1 (ipv6) and when that fails
it falls back to 127.0.0.1. Make sure IPv6 is properly
configured/enabled and try the script again.
--
Adam Tauno Williams <awilliam(a)whitemice.org> LPIC-1, Novell CLA
<http://www.whitemiceconsulting.com>
OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba

From: News123 on
Hi Adam,


Adam Tauno Williams wrote:
> On Thu, 2010-05-20 at 03:40 -0700, Thomas Lehmann wrote:
>>> What's wrong?
>> Obviously there's a problem with "localhost". When using the IP of my
>> machine everything is working fast.

I think you're right.

localhost with IPV6 was also a problem for me. At least it was for me
on a windows 7 host.
I 'solved' the problem by disabling IPV6, but this is a workaround, not
a proper solution.

>
> You box may first be trying to connect to ::1 (ipv6) and when that fails
> it falls back to 127.0.0.1. Make sure IPv6 is properly
> configured/enabled and try the script again.

Do you know why the default config of IPV6 could be wrong on a windows
7 host?

Having no experience with IPV6:

How should it be configured?
How to detect issues?


thanks


N


From: Adam Tauno Williams on
On Thu, 2010-05-20 at 22:46 +0200, News123 wrote:
> Hi Adam,
> Adam Tauno Williams wrote:
> > On Thu, 2010-05-20 at 03:40 -0700, Thomas Lehmann wrote:
> >>> What's wrong?
> >> Obviously there's a problem with "localhost". When using the IP of my
> >> machine everything is working fast.
> I think you're right.
> localhost with IPV6 was also a problem for me. At least it was for me
> on a windows 7 host.
> I 'solved' the problem by disabling IPV6, but this is a workaround, not
> a proper solution.
> > You box may first be trying to connect to ::1 (ipv6) and when that fails
> > it falls back to 127.0.0.1. Make sure IPv6 is properly
> > configured/enabled and try the script again.
> Do you know why the default config of IPV6 could be wrong on a windows
> 7 host?

No. This would seem to have something to do with the resolver. If you
do a nslookup for localhost what does it say.

> Having no experience with IPV6:

Have lots, it's really nice. Once you get most things cut over.

> How should it be configured?
> How to detect issues?

Does nslookup localhost return the correct result? That might depend on
your DNS server - not your local host.

Also "ping ::1"?
--
Adam Tauno Williams <awilliam(a)whitemice.org> LPIC-1, Novell CLA
<http://www.whitemiceconsulting.com>
OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba