Search code examples
pythonpyro

Get caller's IP in Pyro4 application


To cut the story short: is there any way to get IP of untrusted client calling remote proxy object, using Pyro4?

So person A is calling my object from IP 123.123.123.123 and person B from IP 111.111.111.111 is there any way to distinguish them in Pyro4, assuming that they cannot be trusted enough to submit their own IP.


Solution

  • I ran across your question when looking for the same thing. If I understand, on the server side you want to know the IP address the client's socket is connected from, right? If so, this'll do it:

    Pyro4.current_context.client.sock.getpeername()[0]

    Found that in this section of the Pyro4 user's guide