What is the recommended way to detect if a connection created using SWConnection.Instance.Login() is still valid? SWConnection.Instance.Connected still reports true even if I break the connection (for instance by shutting down the local server).
I have tried calling SWConnection.Instance.GetConnectionsInfo and that will throw an Exception if the connection is broken, but this call returns the login information of all logged in users. Should I really use this call?
Best Answer
S
Stacey Hwasser
said
almost 7 years ago
Here is some helpful information:
SWConnecion.Instance.GetConnectionsInfo is not relevant to your use case and and should not be used for this.
SWConnection.Instance.Connected does not actually communicate with the server to find out its status. If you pull the cord in your machine, the network card will detect this and will shut down all connections. This is actually not always good. Compare pulling the cord between 2 routers on the way between the client and the server and then putting the cord back. Unless you tried to make a call during the time, the cord was disconnected, the connection will still work.
So by definition, the connection is not considered disconnected until a real call to the server has failed. This includes the client automatically doing several attempts to reconnect. Always polling to see if the server is up puts unnecessary load on the server and may actually cause the connection to be lost more often if the connection is not 100%, e.g., think wireless.
There is also a callback SWConnection.OnDisconnect that you can take a look at.
We recognize that this is a subject where we are somewhat lacking in functionality so we appreciate your questions and welcome feedback for future development.
1 Comment
Stacey Hwasser
said
almost 7 years ago
Answer
Here is some helpful information:
SWConnecion.Instance.GetConnectionsInfo is not relevant to your use case and and should not be used for this.
SWConnection.Instance.Connected does not actually communicate with the server to find out its status. If you pull the cord in your machine, the network card will detect this and will shut down all connections. This is actually not always good. Compare pulling the cord between 2 routers on the way between the client and the server and then putting the cord back. Unless you tried to make a call during the time, the cord was disconnected, the connection will still work.
So by definition, the connection is not considered disconnected until a real call to the server has failed. This includes the client automatically doing several attempts to reconnect. Always polling to see if the server is up puts unnecessary load on the server and may actually cause the connection to be lost more often if the connection is not 100%, e.g., think wireless.
There is also a callback SWConnection.OnDisconnect that you can take a look at.
We recognize that this is a subject where we are somewhat lacking in functionality so we appreciate your questions and welcome feedback for future development.
Inactive Volvo Group IT account
What is the recommended way to detect if a connection created using SWConnection.Instance.Login() is still valid? SWConnection.Instance.Connected still reports true even if I break the connection (for instance by shutting down the local server).
I have tried calling SWConnection.Instance.GetConnectionsInfo and that will throw an Exception if the connection is broken, but this call returns the login information of all logged in users. Should I really use this call?Here is some helpful information:
SWConnecion.Instance.GetConnectionsInfo is not relevant to your use case and and should not be used for this.
SWConnection.Instance.Connected does not actually communicate with the server to find out its status. If you pull the cord in your machine, the network card will detect this and will shut down all connections. This is actually not always good. Compare pulling the cord between 2 routers on the way between the client and the server and then putting the cord back. Unless you tried to make a call during the time, the cord was disconnected, the connection will still work.
So by definition, the connection is not considered disconnected until a real call to the server has failed. This includes the client automatically doing several attempts to reconnect. Always polling to see if the server is up puts unnecessary load on the server and may actually cause the connection to be lost more often if the connection is not 100%, e.g., think wireless.
There is also a callback SWConnection.OnDisconnect that you can take a look at.
We recognize that this is a subject where we are somewhat lacking in functionality so we appreciate your questions and welcome feedback for future development.
Stacey Hwasser
Here is some helpful information:
SWConnecion.Instance.GetConnectionsInfo is not relevant to your use case and and should not be used for this.
SWConnection.Instance.Connected does not actually communicate with the server to find out its status. If you pull the cord in your machine, the network card will detect this and will shut down all connections. This is actually not always good. Compare pulling the cord between 2 routers on the way between the client and the server and then putting the cord back. Unless you tried to make a call during the time, the cord was disconnected, the connection will still work.
So by definition, the connection is not considered disconnected until a real call to the server has failed. This includes the client automatically doing several attempts to reconnect. Always polling to see if the server is up puts unnecessary load on the server and may actually cause the connection to be lost more often if the connection is not 100%, e.g., think wireless.
There is also a callback SWConnection.OnDisconnect that you can take a look at.
We recognize that this is a subject where we are somewhat lacking in functionality so we appreciate your questions and welcome feedback for future development.
-
Support for Autotest of API applications
-
Major version exception in API
-
Part multiplicity exception in API
-
Get enum attribute value description
-
Item type name from SID
-
Adding an existing item as part to an item using C# API
-
Last Changed date isn't updating
-
Script filer och API
-
How do I return a DataTable instead of IswItems?
See all 19 topics