how to get client info from its request?

leyaleya Member Leya WangOrganization: Wuhan Univ.Project: Scalable Communication ✭✭
it looks like the information are all wrapped in the deeper level

can i get client info such as ip address from its request
i need to get the info from the interface of server

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    You can get this information with the con attribute of Ice::Current. This attribute points to the Ice::Connection object which represents the connection between the server and client. The toString() method of the Ice::Connection interface will allow you to get information about the connection.

    Cheers,
    Benoit.
  • leyaleya Member Leya WangOrganization: Wuhan Univ.Project: Scalable Communication ✭✭
    yea i got the ip from current.con
    it's really convenient
    thanks :)
  • Mart OruaasMart Oruaas Member Mart OruaasOrganization: SkypeProject: In-house devel
    I have a similar question, but in the context of exceptions: if I have a proxy with multiple endpoints and a method call on that proxy throws, how do I find out from which endpoint the exception actually came from? (no, tracing is not an option)
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Mart,

    There is currently no way to get connection or endpoint information from an exception.

    Best regards,
    Bernard
  • Mart OruaasMart Oruaas Member Mart OruaasOrganization: SkypeProject: In-house devel
    Hello,

    Any plans to introduce this into some future version? Would be very userful in any at least moderately-sized environment.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    We're discussing internally on whether or not to add a way to get this information and how it could be added. Could you perhaps tell us a little more on your need for this information? Is this for debugging purposes? Do you need it just for some local exceptions?

    Thanks!

    Cheers,
    Benoit.
  • Mart OruaasMart Oruaas Member Mart OruaasOrganization: SkypeProject: In-house devel
    The use case is quite simple: while having a bunch of boxes (let's say 10+) running the same service, it is very difficult to go hunting for the reason of a particular exception/failure when there is no hint about the source of the exception. It's not so much about feature debugging than about troubleshooting in production environment (one of the ICE services tends to lose DB connectivity now and then. which one?).
  • yongshengyongsheng Member Yongsheng MaOrganization: Dawning Supercomputing Co.Project: cluster
    Hey-

    I would like to get the question derived a little bit under the same title.

    Is there a way in ICE to pull out the following from a client's request?
    (1) client id
    (2) timestamp

    Thanks!

    Y
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Ice doesn't really have any "client ID" or timestamp for a request. It differentiates clients through their connection and requests with an ID. You can retrieve the client connection and request ID with the Ice::Current struct attribute passed to each invocation. See the Ice manual for more information on Ice::Current.

    Cheers,
    Benoit.
  • Oleh BabyakOleh Babyak Member Oleh BabyakOrganization: Skype AGProject: Baboon
    benoit wrote: »
    Hi,

    You can get this information with the con attribute of Ice::Current. This attribute points to the Ice::Connection object which represents the connection between the server and client. The toString() method of the Ice::Connection interface will allow you to get information about the connection.

    Cheers,
    Benoit.

    How about asynchronous calls? Is it possible to determine IP of entity responded to ICE async call?
Sign In or Register to comment.