[Twisted-Python] Getting peer IP address from Perspective Broker

Itamar Shtull-Trauring itamar at itamarst.org
Tue Jul 26 11:04:55 EDT 2005

On Mon, 2005-07-25 at 10:53 -0500, J French wrote:
> Is there an accessible method to retrieve a peer's ip address from
> within pb?  I just want to log it.
> I read the Faq and see how to do it when subclassing protocol i.e.:
> class MyProtocol(protocol.Protocol):
>     def connectionMade(self):
>         print "connection from", self.transport.getPeer()
> I'd appreciate it if someone can point me in the right direction.

remoteReference.broker.transport.getPeer() will do it. The broker
attribute of RemoteReferences is the protocol instance they are
connected to.

More information about the Twisted-Python mailing list