Python – How to do synchronous rpc calls


I'm building a program that has a class used locally, but I want the same class to be used the same way over the network. This means I need to be able to make synchronous calls to any of its public methods. The class reads and writes files, so I think XML-RPC is too much overhead. I created a basic rpc client/server using the examples from twisted, but I'm having trouble with the client.

c = ClientCreator(reactor, Greeter)
c.connectTCP(, self.port).addCallback(request)

This works for a single call, when the data is received I'm calling reactor.stop(), but if I make any more calls the reactor won't restart. Is there something else I should be using for this? maybe a different twisted module or another framework?

(I'm not including the details of how the protocol works, because the main point is that I only get one call out of this.)

Addendum & Clarification:

I shared a google doc with notes on what I'm doing.

I have a version written that uses fuse and can combine multiple local folders into the fuse mount point. The file access is already handled within a class, so I want to have servers that give me network access to the same class. After continuing to search, I suspect pyro ( might be what I'm really looking for (simply based on reading their home page right now) but I'm open to any suggestions.

I could achieve similar results by using an nfs mount and combining it with my local folder, but I want all of the peers to have access to the same combined filesystem, so that would require every computer to bee an nfs server with a number of nfs mounts equal to the number of computers in the network.

I have decided to use rpyc as it gave me exactly what I was looking for. A server that keeps an instance of a class that I can manipulate as if it was local. If anyone is interested I put my project up on Launchpad (

Best Solution

If you're even considering Pyro, check out RPyC first, and re-consider XML-RPC.

Regarding Twisted: try leaving the reactor up instead of stopping it, and just ClientCreator(...).connectTCP(...) each time.

If you self.transport.loseConnection() in your Protocol you won't be leaving open connections.