Something like asynchronous XML-RPC possible?

Will Stuyvesant hwlgw at
Fri Jan 24 12:08:58 CET 2003

I like the XMLRPC support in Python very much.   Thanks Fredrik Lundh
and Brian Quinlan and others I forget!  Using and you can set up a system with distributed and
replaceble and independent processes that can call each others'
operations just like they call a local object.

This means you can do::
  p1 = remoteprocess(url, portnumber)
  result = p1.method1(params)

after you did start an XMLRPC server on http://url:portnumber and
registered a class that has ``method1``.  Note that the caller is
blocking until it receives a return value from ``p1``.

Under the hood the processes communicate by means of TCP.  But now my
boss wants them to communicate by means of UDP!  Any ideas how to
accomplish this?  It would mean that operation or method calls are no
longer possible, only communication via events will be there.  The
desired usage pattern would be::

  p2 = remote_async_process(url, portnumber)

where the event could be just a string for now.  Later it could be
useful to have objects as events, but I could also just turn a string
into any object I need.  What is important is that the caller is *not
blocking* while waiting for a return value from ``p2``.

If you know a solution please let me know.  Especially if the solution
only uses standard Python libraries.  I think it could be done using
just xmlrpclib and SimpleHTTPServer with a UDP request handler or
something, but its usage patterns are confusing me and if you have
done this already please let me know!

If it works, leave it alone -- there's no need to understand it.  If
it fails, try to fix it -- there's no time to understand it.
                - Bill Pfeifer

More information about the Python-list mailing list