IConnection.CloseRequest Event

The CloseRequest event is triggered when the runtime system closes the session with the client.

Namespace – ABSuite.AccessLayer.Connector.Core

Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)

Syntax

event EventHandler<ConnectionCloseRequestArgs> CloseRequest

Using the IConnection Interface for the CloseRequest Event

The following code is an example of using the CloseRequest event:

// HandleHostSessionClosed is the handler for processing the 
// CloseRequest event triggered when a BYE request is sent from the 
// Host application. It checks the ConnectionClosedRequestArgs 
// object for more information about the event.
     public void HandleHostSessionClosed(object sender, ConnectionClosedRequestArgs args)
     {
   // Log a message and clean up the session
        if (args.ForcedClosure)
            ApplicationLogger.LogInfo(() => string.Format("Host system has closed the session!"));
        else
            ApplicationLogger.LogInfo(() => string.Format("Session closed unexpectedly!"));

Session.Abandon();
     }     // Register for CloseRequest event. When the event is triggered, the 
           // specified method is called to handle the event.
     ABSConnection.CloseRequest += HandleHostSessionClosed;