static void ConnectToWCF() { try { proxy = new localhost.PokeInWCF(); bool b; proxy.PingAlive(out b, out b); ServerConnected = true; /* ConnectToWCF method call * made by static constructor or CheckMessage function? * * Check, if there is an existing worker thread */ if (workerThread == null) { workerThread = new System.Threading.Thread(CheckMessages); workerThread.Start(); } CometWorker.SendToAll("UpdateServiceStatus(" + ServerConnected.ToString().ToLower() + ");"); string[] clientIds = CometWorker.GetClientIds(); if (clientIds != null) proxy.AddClients(clientIds); } catch { //Connection Issue re-try after 1.5 secs Thread.Sleep(1500); ConnectToWCF(); } }
public void GetWCFServerTime() { try { localhost.PokeInWCF proxy = new localhost.PokeInWCF(); proxy.Timeout = 1500; PokeIn.Comet.CometWorker.SendToClient(ClientId, "WCFInfo('" + proxy.TestMethod(ClientId) + "');"); } catch { PokeIn.Comet.CometWorker.SendToClient(ClientId, "WCFInfo('<font color=\\\'red\\\'>Run WCF Server Project</font>');"); } }
static void ConnectToWCF() { try { proxy = new localhost.PokeInWCF(); bool b; proxy.PingAlive(out b, out b); ServerConnected = true; /* ConnectToWCF method call * made by static constructor or CheckMessage function? * * Check, if there is an existing worker thread */ if (workerThread == null) { workerThread = new System.Threading.Thread(CheckMessages); workerThread.Start(); } CometWorker.SendToAll("UpdateServiceStatus(" + ServerConnected.ToString().ToLower() + ");"); string[] clientIds = CometWorker.GetClientIds(); if (clientIds != null) { proxy.AddClients(clientIds); } } catch { //Connection Issue re-try after 1.5 secs Thread.Sleep(1500); ConnectToWCF(); } }