private void ConductorSvr_Load(object sender, EventArgs e) { if (IsPortInUse(ProtocolType.Tcp, 50000) || IsPortInUse(ProtocolType.Tcp, 50001)) { System.Windows.Forms.MessageBox.Show("Tcp port 50000 or 50001 is in use, please check it.", "URWPGSim2D Server"); System.Diagnostics.Process.GetCurrentProcess().Kill(); // 没有数据需要保存直接结束当前进程 } // 调试时在同一节点上启动Server服务和Client服务 string[] strArrManifestFileNames = new string[2] { Application.StartupPath + "\\Sim2DSvr.manifest.xml", Application.StartupPath + "\\Sim2DClt.manifest.xml", }; //DssEnvironment.Initialize(50000, 50001, strArrManifestFileNames); // 在50000/50001这组端口上启动一个DSS Node并初始化Server服务实例 string strServerManifestFileName = Application.StartupPath + "\\Sim2DSvr.manifest.xml"; DssEnvironment.Initialize(50000, 50001, strServerManifestFileName); // 等待当前Dss Node上的某Dss Service发生Drop事件执行DssEnvironment.Shutdown命令 DssEnvironment.WaitForShutdown(); // 退出客户端启动引导程序界面不再显示 Application.Exit(); }
public static void shutdown() { if (bank != null) { bank.Dispose(); DssEnvironment.Shutdown(); DssEnvironment.WaitForShutdown(); } }
private void ConductorClt_Load(object sender, EventArgs e) { DssRuntimeConfiguration dssConfig = new DssRuntimeConfiguration(); dssConfig.PublicHttpPort = 0; dssConfig.PublicTcpPort = 0; int port = 40000; do // 从TCP端口40000起查找尚未被占用的端口 { while (IsPortInUse(ProtocolType.Tcp, port)) { port++; } if (dssConfig.PublicHttpPort == 0) { dssConfig.PublicHttpPort = port; port++; } else { dssConfig.PublicTcpPort = port; } } while (dssConfig.PublicHttpPort == 0 || dssConfig.PublicTcpPort == 0); // 调试时在同一节点上启动Server服务和Client服务 string[] strArrManifestFileNames = new string[2] { Application.StartupPath + "\\Sim2DSvr.manifest.xml", Application.StartupPath + "\\Sim2DClt.manifest.xml", }; //DssEnvironment.Initialize(dssConfig, strArrManifestFileNames); // 在50000/50001这组端口上启动一个DSS Node并初始化Server服务实例 string strServerManifestFileName = Application.StartupPath + "\\Sim2DSvr.manifest.xml"; //DssEnvironment.Initialize(dssConfig, strServerManifestFileName); // 在40000/40001这组端口上启动一个DSS Node并初始化Client服务实例 string strClientManifestFileName = Application.StartupPath + "\\Sim2DClt.manifest.xml"; DssEnvironment.Initialize(dssConfig, strClientManifestFileName); // 等待当前Dss Node上的某Dss Service发生Drop事件执行DssEnvironment.Shutdown命令 DssEnvironment.WaitForShutdown(); // 退出客户端启动引导程序界面不再显示 Application.Exit(); }
/// <summary> /// Shut down the DSS node and MSRDS services. This method waits /// for everything to shut down before returning. /// </summary> public static void Shutdown() { LastStateChange = RobotStateChange.SHUTDOWN; try { if (bank != null) { bank.Dispose(); } } catch (Exception) { } try { DssEnvironment.Shutdown(); DssEnvironment.WaitForShutdown(); } catch (Exception) { } LastStateChange = RobotStateChange.SHUTDOWN_COMPLETE; }