incorrect transaction ID

Forum Home Forums Development and Integration incorrect transaction ID

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #13222
    Zeus
    Participant

    Hi Mik

    I use the code below to access data from server.
    The server returns error message
    Incorrect format of data received from the server: incorrect transaction ID

    static void GetCurrentDataConcurrency()
    {
        CnlData[] cnlData;
    
        for (int i = 0; i < 1000; i++)
        {
            Task.Run(() =>
            {
    
                if (cnlListID > 0)
                {
                    Console.WriteLine("Request data of the list with ID = " + cnlListID);
                    cnlData = client.GetCurrentData(ref cnlListID);
                }
                else
                {
                    Console.Write("Enter channel number: ");
                    int[] cnlNums = new int[] { 101,102 };
                    cnlData = client.GetCurrentData(cnlNums, true, out cnlListID);
                }
    
                if (cnlData == null)
                    Console.WriteLine("Error: null received");
                if (cnlData.Length > 0)
                    Console.WriteLine("Channel data = " + cnlData[0].Val + " (" + cnlData[0].Stat + ")");
                else
                    Console.WriteLine("No data");
    
                Console.WriteLine("Channel list ID = " + cnlListID);
            });
            Thread.Sleep(10);
        }
    }
    
    • This topic was modified 1 year, 2 months ago by Mikhail.
    #13224
    Mikhail
    Moderator

    Hi,
    ScadaClient is class is not thread safe, while you execute client.GetCurrentData in many threads.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.