コード例 #1
0
 public ServerManager(
     CmdServer server,
     UnityClient client)
 {
     _server = server;
     _client = client;
 }
コード例 #2
0
ファイル: SyncCmd.cs プロジェクト: lulzzz/simias
        int RunServer()
        {
            if (host == null)
            {
                host = MyDns.GetHostName();
            }
            CmdServer server = new CmdServer(host, port);

            Console.WriteLine("server {0} started, press enter to exit", port);
            Console.ReadLine();
            server.Stop();
            return(0);
        }
コード例 #3
0
ファイル: DataModeling.cs プロジェクト: VisuMap/OpenVisuMap
        public virtual void Initialize(IApplication app)
        {
            App = app;

            if (app.ScriptApp.ApplicationBuild < 935)
            {
                MessageBox.Show("Data Modeling plugin requires VisuMap 5.0.935 or higher!",
                                "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            app.InstallPluginObject(mdScript = new ModelingScript());

            ToolStripMenuItem miPlugin = App.GetPluginMenu();
            var gm = app.ScriptApp.GuiManager;

            miPlugin.DropDownItems.Add("Model Training", null, (s, e) => gm.ShowForm(new ModelTraining(), true));
            miPlugin.DropDownItems.Add("Model Evaluation", null, (s, e) => gm.ShowForm(new ModelTest(), true));
            miPlugin.DropDownItems.Add("Model Server", null, (s, e) => gm.ShowForm(new ModelServer(), true));
            miPlugin.DropDownItems.Add("Model Manager", null, (s, e) => gm.ShowForm(new ModelManager2(), true));

            app.InstallScriptPlugin(new PythonEngine());
            //app.InstallScriptPlugin(new J8Engine());

            propMan    = new VisuMap.Lib.PropertyManager(this, "Settings", "DataModeling");
            pluginRoot = DataModeling.App.GetPluginDataNode(0, "DataModeling", propMan.NameSpace, true);
            propMan.LoadProperties(pluginRoot);
            homeDir = app.ScriptApp.GetProperty("DataModeling.HomeDir", "");
            workDir = app.ScriptApp.GetProperty("DataModeling.WorkDir", "");
            if (!homeDir.EndsWith("\\"))
            {
                homeDir += "\\";
            }
            if (!workDir.EndsWith("\\"))
            {
                workDir += "\\";
            }

            SetDefaultWorkDir();
            modelManager = new ModelManager();

            app.InstallFileImporter(new NumpyFileImport());

            cmdServer = new CmdServer();
            cmdServer.Start();
            app.ShuttingDown       += App_ShuttingDown;
            app.ApplicationStarted += App_ApplicationStarted;
        }
コード例 #4
0
ファイル: CommunicationsBridge.cs プロジェクト: VoxML/Jarvis
 public void OpenPortInternal(string port)
 {
     try {
         // pass true as first param to make the server visible only to 'localhost'
         // (for testing, for exmaple)
         _cmdServer = new CmdServer(false, int.Parse(port), 1);
         OnPortOpened(this, null);
     }
     catch (Exception e) {
         Debug.Log("Failed to open port " + port);
         Debug.Log(e.Message);
         Debug.Log(e.InnerException);
         Debug.Log(e.StackTrace);
         Debug.Log(e.Data);
     }
 }
コード例 #5
0
ファイル: CommunicationsBridge.cs プロジェクト: VoxML/Jarvis
            void OnDestroy()
            {
                if (_cmdServer != null)
                {
                    _cmdServer.Close();
                    _cmdServer = null;
                }

                for (int i = 0; i < _socketConnections.Count; i++)
                {
                    if (_socketConnections[i] != null && _socketConnections[i].IsConnected())
                    {
                        _socketConnections[i].Close();
                        _socketConnections[i] = null;
                    }
                }

                //if (_fusionSocket != null && _fusionSocket.IsConnected()) {
                //    _fusionSocket.Close();
                //    _fusionSocket = null;
                //}

                if (_commanderSocket != null && _commanderSocket.IsConnected())
                {
                    _commanderSocket.Close();
                    _commanderSocket = null;
                }

                if (_ksimSocket != null && _ksimSocket.IsConnected())
                {
                    _ksimSocket.Close();
                    _ksimSocket = null;
                }

                if (_adeSocket != null && _adeSocket.IsConnected())
                {
                    _adeSocket.Close();
                    _adeSocket = null;
                }
            }
コード例 #6
0
        /// <summary>
        /// 获取命令请求分发服务器信息命令执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            byte[] cmdData = context.CmdData;
            if (cmdData.Length != 4)
            {
                context.Flush(RespondCode.CmdDataLack);
                return;
            }

            int lastVer = BitConverter.ToInt32(cmdData.Reverse(), 0);

            if (Compiled.Debug)
            {
                cmdData.Debug("=== Support.CmdDispatch 上行数据===");
                lastVer.Debug("=== Support.CmdDispatch 上行数据 ===");
            }

            CmdConfig config         = CmdConfigs.GetCmdConfigFromStorage();
            var       cmdWithServers = config.CmdList.Where(c => c.VCode > lastVer);

            if (cmdWithServers.Count() > 0)
            {
                CmdServer result = new CmdServer
                {
                    LastVer  = cmdWithServers.Max(c => c.VCode),
                    DataList = cmdWithServers.Select(c => new KvPair {
                        Key = c.Cmd, Value = c.Server
                    }).ToList()
                };
                context.Flush <CmdServer>(result);
            }
            else
            {
                context.Flush();
            }
        }