public void Open() { try { mRouteCenter = new RouteCenter(); mRouteCenter.Register(this); if (!System.IO.Directory.Exists(UNIT_TESTCASE_PATH)) { System.IO.Directory.CreateDirectory(UNIT_TESTCASE_PATH); } mServerClient = BeetleX.ServerFactory.CreateTcpClient <Network.ClientPacket>(ServerHost, ServerPort); mNodeServer = BeetleX.ServerFactory.CreateTcpServer <NodeApp, Network.Packet>(mNetConfig); mNodeServer.Handler = this; while (!mNodeServer.Open()) { mNodeServer.Config.Port++; } Loger.Process(LogType.INFO, "Note network start!"); LoadProcessAgent(); Loger.Process(LogType.INFO, "Note load unittest completed!"); mServerClient.ClientError = OnServerError; mServerClient.ConnectedServer = OnServerConnect; mServerClient.Packet.Completed = OnPacketCompleted; if (mServerClient.Connect()) { Loger.Process(LogType.INFO, "Note connect to {0}", ServerHost); } else { Loger.Process(LogType.ERROR, "Note connect to {0} error {1}", ServerHost, mServerClient.LastError.Message); } this.Performance.Open(); } catch (Exception e_) { Loger.Process(LogType.INFO, "Note network start error {0}", e_.Message); } if (mPingTimer != null) { mPingTimer.Dispose(); } mPingTimer = new System.Threading.Timer(PingServer, this, 1000, 1000); }
public void Open(string host, int port, string cliHost, int cliPort) { mRouteCenter = new MR.RouteCenter(); mRouteCenter.Register(this); if (!System.IO.Directory.Exists(mUnitTestPath)) { System.IO.Directory.CreateDirectory(mUnitTestPath); } mCenterNetConfig.Host = host; mCenterNetConfig.Port = port; mCliNetConfig.Host = cliHost; mCliNetConfig.Port = cliPort; CreateCenterServer(); CreateManagerServer(); mTestFolderManager = new TestFolderManager(mUnitTestPath); mNodeManager = new NodeManager(this); mTestFolderManager.Center = this; mTestFolderManager.Log = this.Loger; mTestFolderManager.Open(); }