This project is read-only.

Failed to initiate an advise loop using threads

Aug 6, 2010 at 8:13 AM


I was wondering is it possible to create multiple instances of DdeClient using threads. The code below is as shown below. For the first instance, it works, second instance fails.


        private void CreateDdeThread(object data)
            Spark spark = (Spark)data;
            DdeClient ddeClient = new DdeClient("Spark", spark.GetSymbol() + ".Depth");
            ddeClient.Disconnected += OnDisconnected;
            ddeClient.StartAdvise("BuyCount.BuyVolume.Buy.Sell.SellVolume.SellCount." + spark.GetMarketDepth(), 1, true, 60000);
            ddeClient.Advise += OnAdvise;


Aug 9, 2010 at 11:39 AM
Edited Aug 9, 2010 at 11:49 AM

I guess you need to manage opening / closing connecitons and starting / stopping advise loops appropriately. As far as I experienced it is not possible to subscribe to the same event twice without unsubscrbing. Of course this might depend on the DDE server.