On Mon, Jan 16, 2017 at 10:15 PM, Роман Мещеряков
<romanmescherya...@yandex.ru> wrote:
> Hi everyone! I’m new to Twisted and mailing lists, so please excuse me if I
> make some mistake. My question maybe trivial, but as far as I know it is
> neither explained on the twistedmatrix.com web site nor easily resolved
> using Google search. The question is: how can Perspective Broker server get
> an IP address of the client the server is being called by? For example,
> let’s consider first PB server example on the Using Perspective Broker page,
> pbsimple.py. Inside remote_echo method of the Echoer class, how one could
> obtain IP address of a client that is calling this method?
>
> One of solutions I found in Google requires client to pass some
> pb.Referenceable object as a parameter to a call, and then server is able to
> get client’s IP address by calling broker.transport.getPeer().host on that
> object. But passing pb.Referenceable just for purpose of getting caller’s IP
> address seems not very convenient. Are there more simple way?

Have not used PB myself, but based on the rest of twisted,
self.transport.client should have the information you need?

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to