The Protocol Session package provides interfaces and classes for handling keep alive messages and time outs on a connection.

Overview

To make sure the connection between a server and a client is up, both the server and the client regurlarly sends messages, and assumes messages from each other. The Asio sockets does not always inform when a connection is closed, and therefor these are required in order to close down such connections correctly.

The keep-alive writer keeps track of records send over the connection, and if a record has not been sent within a given time frame, a keep-alive record is sent.

The keep-alive reader keeps track of incoming records over the connection, and if a record has not been received over the connection within a given time frame, the connection is closed down. If a keep-alive message is received, this is filtered out, so the user does not need to handle those.