[Stackless] XML-RPC Library
frederick.ryckbosch at ugent.be
frederick.ryckbosch at ugent.be
Fri Aug 28 16:10:39 CEST 2009
Thanks for the suggestions !
I tried the stacklesssocket solution using the below code, with a
'wait-service': this service waits 10 seconds and then returns RESULT.
====
from concurrence import Tasklet, dispatch
import xmlrpclib, stacklesssocket
stacklesssocket.install()
def xml_rpc_call():
connection = xmlrpclib.ServerProxy('http://127.0.0.1:8888/')
print connection.test_service.wait()
def dots():
while True:
print "."
Tasklet.sleep(1)
def main():
Tasklet.new(xml_rpc_call)()
Tasklet.new(dots)()
dispatch(main)
====
There is an odd thing about this: when I remove
stacklesssocket.install(), the output is:
RESULT
.
.
and so on. With the stacklesssocket.install(), the output is:
.
RESULT
.
and so on. The stacklesssocket seems to be nonblocking, as the dots
tasklet can print the dot once. The dots tasklet does a sleep and then
the xml-rpc tasklet is in control, this time however, it blocks...
Anybody an idea about what's wrong ?
Thanks a lot!
Frederick
Quoting Richard Tew <richard.m.tew at gmail.com>:
> 2009/8/27 Kristján Valur Jónsson <kristjan at ccpgames.com>:
>> Depends on what you mean by non-blocking.
>> We use the standard xml-rpc library with a "stackless blocking"
>> socket module.
>> Look in the list archive, there was a discussion about various
>> non-blocking stackless sockets solutions a few weeks back.
>
> Yeah, it is much better to replace standard sockets with
> stackless-compatible ones if you are going to use Stackless. Then you
> do not carry the burden of using a custom version of a library. The
> standard ones just work.
>
> Here's Andrew Dalke's canonical example of urllib being used this way:
> http://www.stackless.com/pipermail/stackless/2006-September/002796.html
>
> Stackless socket web page:
> http://code.google.com/p/stacklessexamples/wiki/StacklessNetworking
>
> Cheers,
> Richard.
>
More information about the Stackless
mailing list