예제 #1
0
        //------------------------------------------------------------------------------------------------------------------------
        #endregion

        #region Functions
        //------------------------------------------------------------------------------------------------------------------------
        public void Init(string processname, string processargs)
        {
            tcpimageserver = new TCPImageServer();
            Task.Run(() =>
            {
                tcpimageserver.Start(8000);
            }
                     );
            //wait for start
            while (tcpimageserver.Started == false)
            {
                Task.Delay(200).Wait();
            }
            DebugEx.TraceLog("TCP Server started");
            //python process
            p = new Process();
            p.StartInfo.FileName               = processname;
            p.StartInfo.Arguments              = processargs;
            p.StartInfo.UseShellExecute        = false;
            p.StartInfo.RedirectStandardInput  = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError  = true;
            p.Start();
            Task.Delay(500).Wait();
            DebugEx.TraceLog("try to start python " + p.HasExited);
            //redirect standard input abd outpout to steamers
            sw = p.StandardInput;
            sr = p.StandardOutput;
            //start reading from python
            PythonReader = Task.Run((Action)HandlePythonEvents);
            //python process start
        }
예제 #2
0
파일: Transport.cs 프로젝트: yodiwo/plegma
        //------------------------------------------------------------------------------------------------------------------------
        #endregion

        #region Functions
        //------------------------------------------------------------------------------------------------------------------------
        public void Init(string processname, string processargs)
        {
            tcpimageserver = new TCPImageServer();
            Task.Run(() =>
            {
                tcpimageserver.Start(8000);
            }
            );
            //wait for start
            while (tcpimageserver.Started == false)
                Task.Delay(200).Wait();
            DebugEx.TraceLog("TCP Server started");
            //python process
            p = new Process();
            p.StartInfo.FileName = processname;
            p.StartInfo.Arguments = processargs;
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardInput = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;
            p.Start();
            Task.Delay(500).Wait();
            DebugEx.TraceLog("try to start python " + p.HasExited);
            //redirect standard input abd outpout to steamers
            sw = p.StandardInput;
            sr = p.StandardOutput;
            //start reading from python
            PythonReader = Task.Run((Action)HandlePythonEvents);
            //python process start
        }