Home Forums Support Closed/closing connection strategy Reply To: Closed/closing connection strategy

#2262
Anonymous
Inactive

The error means the connection you are attempting to use is marked as disconnected. If connections go over the internet there are many reasons why they might be closed, outside of your control. If all connections are within the same network then a closed connection suggests either an error or that you are closing a connection unintentionally in code.

The best solution to find out why connections are being closed is to enable logging (link). Look for all references starting “Closing connection with“.

If this is an issue client side whenever you need access to a connection it is preferable to use:

TCPConnection.GetConnection(ConnectionInfo).SendObject("Data", customObject);

which maximises the chances of having an established connection, rather than maintaining a reference to a previously established connection and always using that. An alternative, as you suggest, is to use the ConnectionCloseHandler to reconnect.

Hope that points you in the right direction to a suitable solution. Please post back with any further issues.

Regards,
Marc