Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 20:50:08 +0000



Post From: ACSIL sc.ServerConnectionState behavior

[2016-03-04 15:39:26]
William O - Posts: 16
I have a study that is monitoring if the sc.ServerConnectionState is not connected. However, when the trade / data service disconnects, the subsequent call to the study still shows the ServerConnectionState == SCS_CONNECTED. I cannot detect if the trade service is disconnected until it is connected again. Please see this example for an illustration:

  
int lastValue = sc.GetPersistentInt(10);

  //Check if there was a change in the server state
  if (lastValue != sc.ServerConnectionState)
  {
    //write to log if not connected to trade / data service
    if (sc.ServerConnectionState != SCS_CONNECTED)
    {
      sc.AddMessageToLog("*************** NOT CONNECTED TO TRADE/DATA SERVICE *******************", 1);
    }
  }

  //save the current server state
sc.SetPersistentInt(10, sc.ServerConnectionState);

If you have this in a study and disconnect from a data / trade service you will not see the log message until after you reconnect. I was expecting to see this message as soon as the trade service disconnects.

Please let me know if this is intended behavior or if I'm missing something. In my code I need to know when the trade service disconnects. Thanks in advance!