static void putThreadProc(Object stateInfo) { int threadID = System.Threading.Thread.CurrentThread.ManagedThreadId; Console.WriteLine("Calling WCF Server from thread id...." + threadID); ServiceReference1.StockMarketClient proxy = new ServiceReference1.StockMarketClient(); string stockName = "threadID-" + threadID; for (int j = 0; j < 30; j++) { stockName = "threadID-" + threadID + "-" + j + "-"; for (int i = 0; i < 100; i++) { // proxy.BeginputStockValue(stockName + i, null, null); if (i % 10 == 0) { System.Threading.Thread.Sleep(1000); } } System.Threading.Thread.Sleep(10000); } }
static async Task GetThreadProc() { int threadId = System.Threading.Thread.CurrentThread.ManagedThreadId; Console.WriteLine("Calling WCF Server from thread id...." + threadId); ServiceReference1.StockMarketClient proxy = new ServiceReference1.StockMarketClient(); await proxy.getStockValueAsync(""); }