Home Help Center

Client Disconnect Callback

Is there a way to set up a callback on a client disconnect so that resources relating to that client can be cleaned up.
Or,is the only option to periodically review connections to see when client last communicated.
I noticed that with the ice logging turned on , an exception was raised when the client dropped off (for tcp connections art least). Is there any way to trap this event.


  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    There is no such callback. Ice can establish and terminate connections transparently. If a connection is closed, it doesn't mean that a client has terminated, as the connection may be reopened at any time. Furthermore, it is not possible to reliably detect connection closure with TCP/IP.

    I guess what you really need is session management, for example like Glacier does it. There are many ways to do this, such as having a thread that cleans up sessions for clients that have been idle for a certain period of time.
  • robert.vazanrobert.vazan Member Robert VazanOrganization: WBP onlineProject: Financial news delivery network
    Sorry for waking up a decade old thread, but I see meaningful use for such functionality.

    I would like to have custom logging of client connection/disconnection for diagnostic purposes. Just have some way to log "Adapter X accepted connection from IP address a.b.c.d". Similar message would be logged when the client disconnects. ACM won't interfere in our case since our clients generate continuous stream of ice_ping calls.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Robert,

    You can use the new instrumentation facility for this purpose (only available since Ice 3.5). See Instrumentation Facility in the Ice manual and the Slice API documentation for more information on how to use this facility. Note that if you install a communication observer, this will disable the metrics administrative facet, Ice currently doesn't support using both.

  • robert.vazanrobert.vazan Member Robert VazanOrganization: WBP onlineProject: Financial news delivery network
    This indeed solves the problem completely. Too bad it cannot be combined with the metrics API. I find that a little surprising though since observers are usually easy to multiplex via intermediate multi-cast observer. Not sure how to configure Ice in this way though.
  • sarlanorisarlanori Member Alex ChouOrganization: PersonalProject: Just Interested in Ice
    Sounds greate,but our current project uses Ice 3.4.2,what a pity!
Sign In or Register to comment.