Exemplo n.º 1
0
        /// <summary>
        /// 监听
        /// </summary>
        public void ListenClient()
        {
            TcpClient client = null;

            while (true)
            {
                if (Stop)
                {
                    break;
                }
                try
                {
                    client = lister.AcceptTcpClient();
                }
                catch
                {
                    break;
                }
                TelCommand cmd = new TelCommand(client);
                list.Add(cmd);

                string info = "来自" + client.Client.RemoteEndPoint + ",信息:" + cmd.CmdStr + "\r\n";

                //Geo.Utils.Command comand = new Utils.Command();
                //comand.RunAsyn(cmd.CmdStr);

                ShowInfo(info);
            }
        }
Exemplo n.º 2
0
        public void ListenClient()
        {
            try
            {
                while (true)
                {
                    if (Stop)
                    {
                        break;
                    }
                    try
                    {
                        client = lister.AcceptTcpClient();
                    }
                    catch (Exception ex)
                    {
                        ShowInfo(ex.Message);
                        break;
                    }
                    TelCommand cmd = new TelCommand(client);
                    list.Add(cmd);

                    string info = "来自" + cmd.LocalEndPoint + ",命令:" + cmd.CmdStr + "\r\n";
                    ShowInfo(info);
                    ShowInfo("开始执行任务....");

                    currentTask = Task.ParseXml(TelMsg.ParseXml(cmd.CmdStr).XmlContent);

                    runner = new TaskRunner(Gnsser.Interoperation.Bernese.BerBpe.BerGpsDataPath);
                    runner.InfoProduced += runner_InfoProduced;
                    runner.TaskFinished += runner_TaskFinished;
                    runner.RunAsyn(currentTask);
                }
            }
            catch (Exception ex)
            {
                if (!this.IsDisposed)
                {
                    ShowInfo("运行错误:" + ex.Message);
                }
            }
        }
Exemplo n.º 3
0
        public void ListenClient()
        {
            //try
            //{
            while (true)
            {
                if (Stop)
                {
                    break;
                }
                try
                {
                    TcpClient = TcpListener.AcceptTcpClient();
                }
                catch (Exception ex)
                {
                    ShowInfo(ex.Message);
                    break;
                }
                TelCommand cmd = new TelCommand(TcpClient);
                list.Add(cmd);

                string info = "来自" + cmd.LocalEndPoint + ",命令:" + cmd.CmdStr + "\r\n";
                ShowInfo(info);
                ShowInfo("开始执行任务....");

                //解析并保存到当前目录
                CurrentTask = GofTask.ParseXml(TelMsg.ParseXml(cmd.CmdStr).XmlContent);
                var localGofPath = SaveGofToLocal(CurrentTask);

                //开始执行
                var pathes = new string[] { localGofPath };
                this.AppendPathToTextBox(pathes);
                this.AddTasksAndRun(pathes);
            }
            //}
            //catch (Exception ex)
            //{
            //    if (!this.IsDisposed)
            //        ShowInfo("运行错误:" + ex.Message);
            //}
        }