This forum has been archived. Please start a new discussion on GitHub.

How to get client's IP address


Can you tell me how to get the client's IP address at server. Can I use Ice::Current to get the connection's peer address?


  • mes
    mes California
    If you are using Ice 2.0, you can call the toString operation on the Ice::Connection object, which is a member of Ice::Current. This provides a human-readable description of the connection's addresses; if you want only the client's remote address, you would have to parse this string to extract that information.

    Note that Ice::Connection is not currently documented, and will likely be enhanced in future releases.

    Take care,
    - Mark
  • Hi

    I write the Server in python. But I can't access the Ice::Connection object (it 's name should be 'con') throuth the Ice::Current object 'current', the usage was here:

    class XXX(XXXX):
    def xxx(self,current):
    s = current.con.toString() # <-- error here

    Is there any mistake in my usage?
  • mes
    mes California
    Sorry, Ice::Connection isn't supported in the current release of the Python mapping. We'll add it in the next release, which should be available early next year.

    - Mark
  • OK. I'll wait. Thanks for your work!