How to detect disconnection?

Kevin Cernekee cernekee at
Mon Sep 15 10:30:08 PDT 2014

On Mon, Sep 15, 2014 at 10:05 AM, Fabian Jäger
<fabian.jaeger at> wrote:
> Dear openconnect experts,
> I have a customer reporting that his connection is disconnected remotely after 24 hours

FWIW, this might be due to the "X-CSTP-Session-Timeout" setting.

> which would require a reconnection on the client side. But how would I detect such a disconnection? Is openconnect detecting it itself and reporting something? I guess there is no related interface in the API, right?

Do you know what return code you're getting back from
openconnect_mainloop() after the disconnection?  I would expect to see
-EIO for most server-initiated disconnections: session timeout,
inactivity timeout, or "vpn-sessiondb logoff all".

The log messages should indicate whether you received an explicit
termination packet, failed to reconnect after multiple DPD timeouts,
saw junk packet data on the CSTP connection, etc.

More information about the openconnect-devel mailing list