Home Forums Support Connection Lost Handler Reply To: Connection Lost Handler

#1231
Anonymous
Inactive

Heya Paul,

Many kind thanks for your interest in our library and welcome to our forums.

How can I add a Connection Lost Handler to Both Server and Client?

You can either configure a global connection close handler using NetworkComms.AppendGlobalConnectionCloseHandler or a connection specific one using Connection.AppendShutdownHandler.

Also It seems that Netcomms has no Connection Established Boolean. Thus how to check if Connection is present.

If you have a reference to the connection in question look at the properties of Connection.ConnectionInfo, i.e. ConnectionInfo.ConnectionState.

If you don’t have a connection reference see NetworkComms.ConnectionExists or NetworkComms.GetExistingConnection methods.

Moreover the clients need to connect to the server when the server is alive. There is no reconnection count or reconnection try wait for the client to use.

There are several desirable solutions for when a connection is closed or lost. As a consequence we leave this down to the end user. For example you could implement a reconnection attempt from within a connection close handler as discussed above.

Kind regards,
Marc