static void Main() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledException); try { CommonConfig.ConfigBll.GetInst().LoadConfig(); AGENT_NAME = GlobalValues.AGENT_NAME; AGENT_FILTER = GlobalValues.AGENT_FILTER; log = LogBll.GenLogBll(AGENT_NAME); Thread t = new Thread(() => startListen()); t.Start(); for (; ;) { log.HeartBeat("I'm alive"); Thread.Sleep(1000 * 20); } } catch (MongoConnectionException ex) { Console.WriteLine("无法连接到server端!请检查ip配置及网络连接后重试"); } catch (SocketException ex) { Console.WriteLine("连接被中断,请检查网络连接,重启本程序!\n" + "错误信息:" + ex.Message); } }
static void Main() { Thread t = new Thread(() => startListen()); t.Start(); for (; ;) { log.HeartBeat("I'm alive"); Thread.Sleep(1000 * 20); } }
static void Main() { CommonConfig.ConfigBll.GetInst().LoadConfig(); log = LogBll.GenLogBll("AgentTest1"); Thread t = new Thread(() => startListen()); t.Start(); for (; ;) { log.HeartBeat("I'm alive"); Thread.Sleep(1000 * 20); } }