[Twisted-Python] Closing PB Connections

Justin Johnson justinjohnson at fastmail.fm
Thu Apr 1 09:10:40 MST 2004


I found some stuff on google about this but it still isn't clear to me
what I need to do.

I noticed that everytime I make a new connection via PB, the server has
another ESTABLISHED connection between itself and the PB client box (via
netstat output).  Do I need to do something to close these connections?

I connect as follows:

class MyClient:

    ...

    def connectToServer(self, server):
        """Connect to the RatControl service
        """
        factory = pb.PBClientFactory()
        reactor.connectTCP(server, pbPortNumber, factory)
        d = factory.login(credentials.UsernamePassword(self.username,
        self.password), None)
        return d



    def someMethod(self):
        ...
        d = self.connectToServer(server)
        d.addCallback(_cbDoSomething, arg1, arg2)

Thanks.
-Justin




More information about the Twisted-Python mailing list