Home Help Center

ICE connection lifecycle information/implementing recovery

mcrystalmcrystal Member Mayer CrystalOrganization: Goldman SachsProject: N/A
Is there any mechanism for listening for connection lifecycle information (i.e. connection created, connection closed, attempting to connect, etc...)? I realize that this may be difficult since ice supports connectionless protocols. The case that I am specifically trying to handle is as follows:

1. I create a connection to a server using a tcp based protocol
2. I register a callback to recieve messages from the server (bi-directional connection)
3. The server goes down

What I would in theory like to be able to do now is to reconnect to another server proactively (not waiting for a client invocation) and, in addition, register for callbacks on the new server. So I guess one question that I have is that if the connection creation and the registration of a callback are independent, and re-connection is handled automatically by the ICE runtime, how do I know that I have to re-register my server callback with the new server? Additionally, since the reconnection might have taken some time, I would like to switch my client into a recovery mode so that I can request all the messages since the last one I received and buffer any new notifications until I know I have processed everything. Since there is no hook into the connection lifecycle, how would I figure out that I should switch into recovery mode and request all messages and buffer all 'live' messages?



  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Ice does not support callbacks for connection closure. Please see this FAQ for details. Of particular importance is the last point: you do not always get a proper TCP notification for connection closure (for example, you won't get a TCP FIN message if someone just "cuts the cable"), therefore applications shouldn't depend on this.

    The best solution is a separate thread that checks whether connections are still healthy (with periodic calls to ice_ping()), and notifies the relevant parts of an application if a connection is down.
Sign In or Register to comment.