Howdy folks.

Was wondering if you could point me in the right direction. Not sure if 
stacklesssocket is your project exactly though.

I'm having trouble with the basic python xmlrpc client over stacklesssocket. 
Basically, whenever I try to connect, the tasklet hangs. Other network 
protocols (basic http and memcache connections) seem to work fine. Also, the 
SimpleXMLRPCServer works fine under stacklesssocket. Seems to only be the 
xmlrpc client.

Anyone know how to tweak stacklesssocket to work with xmlrpc? I've attached 
runnable example code.

(notes on the code: I added the timeout_func when stacklesssocket complained to 
me about not having it. Also, if the loop tasklet is taken out, the process 
exits naturally without finishing the xmlrpc call. So I'm assuming there's a 
channel waiting on a message that never comes somewhere...)

stacklesssocket is from here: 
http://stacklessexamples.googlecode.com/svn/trunk/examples/networking/stacklesssocket.py
 and the stackless version itself is 2.63

cheers

Ray


      
import stackless
import stacklesssocket
import xmlrpclib
import urllib2

def connect_to_google():
    urllib2.urlopen("http://google.com";).read()
    print "Connected to google"

def connect_to_xmlrpc():
    conn = xmlrpclib.ServerProxy("http://localhost:8888";, allow_none=True)
    print "Attempting to connect"
    print conn.ping()

def timeout_func(timeout, channel, error):
    print "Timeout happened"

def loop():
    while True:
        stackless.schedule()

if __name__ == "__main__":
    stacklesssocket.install()
    stacklesssocket._timeout_func = timeout_func

    stackless.tasklet(connect_to_google)()
    stackless.tasklet(connect_to_xmlrpc)()
#    stackless.tasklet(loop)()
    stackless.run()
import stackless
import stacklesssocket
from SimpleXMLRPCServer import SimpleXMLRPCServer

def ping():
    print "ping"
    return "pong"

def timeout_func(timeout, channel, error):
    print "Timeout happened"

def run_server():
    stacklesssocket.install()
    stacklesssocket._timeout_func = timeout_func

    server = SimpleXMLRPCServer(("localhost", 8888), allow_none=True)
    server.register_function(ping, "ping")
    server.serve_forever()

if __name__ == "__main__":
    stackless.tasklet(run_server)()
    stackless.run()
_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to