IronPython-0.6 is now available!

Valentino Volonghi aka Dialtone dialton3#NOSPAM.JJJJKIKK at virgilio.it
Fri Jul 30 08:50:16 CEST 2004


On Fri, 30 Jul 2004 10:11:13 +1000, Derek Thomson wrote:

> I suspect he'll be disappointed with "Twisted", as I was. I had a
> quick look at it, and the support for RPC is primitive, at best.
> 
> It's a "round-peg-square-hole" situation given that Twisted is "event
> based", but it's pretty hard to build a distributed object system if
> you can't call a method on a remote object easily ... still, it may
> just be a matter of focus (i.e. the Twisted team haven't really
> haven't done much in the area of RPC/distributed objects yet, by the
> look of it). It will be interesting to see how it develops over time.

Err... What do you mean? Twisted has, at least, 3 different ways of doing
RPC: Perspective Broker, SOAP and XML-RPC.

Perspective Broker is a new RPC protocol which lets you pass objects
remotely and so on.
The other 2 are already well known.

This is a pb server and down here a pb client. How is this
'primitive'? (SOAP and XML-RPC are a lot like these 2 examples below)
====
from twisted.spread import pb
from twisted.internet import reactor

class Echoer(pb.Root):
    def remote_echo(self, st):
        print 'echoing:', st
        return st

if __name__ == '__main__':
    reactor.listenTCP(8789, pb.PBServerFactory(Echoer()))
    reactor.run()

====
from twisted.spread import pb
from twisted.internet import reactor
from twisted.python import util

factory = pb.PBClientFactory()
reactor.connectTCP("localhost", 8789, factory)
d = factory.getRootObject()
d.addCallback(lambda object: object.callRemote("echo", "hello network"))
d.addCallback(util.println)
d.addCallback(lambda _: reactor.stop())
reactor.run()
====

-- 
Valentino Volonghi aka Dialtone
Linux User #310274, Proud Gentoo User
Blog: http://vvolonghi.blogspot.com
Home Page: http://xoomer.virgilio.it/dialtone/




More information about the Python-list mailing list