예제 #1
0
파일: ReplServer.cs 프로젝트: vogon/nomic
        private async Task AcceptLoop()
        {
            _listener.Start();

            while (true)
            {
                TcpClient tcpClient = await _listener.AcceptTcpClientAsync();

                // connection established; build a client object
                Client client = new Client { TcpClient = tcpClient };

                // set up a repl
                NetworkStream stream = tcpClient.GetStream();
                TextReader r = new StreamReader(stream);
                TextWriter w = new StreamWriter(stream);

                ConsoleReplView view = new ConsoleReplView(r, w);
                Repl repl = new Repl(view, new IronPythonEvaluationContext());

                client.Repl = repl;

                // service the repl
                client.ServiceTask = Task.Run(() => ServiceLoop(client));
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: vogon/nomic
        private void ServeLocalInteraction()
        {
            while (!_shutdown)
            {
                IronPythonEvaluationContext lang = new IronPythonEvaluationContext();
                Repl repl = new Repl(new ConsoleReplView(), lang);

                // HACK: load static scripts so I have something to test
                repl.LoadScripts(_staticScripts);

                Task t = repl.Main();

                t.Wait();

                if (!_shutdown)
                {
                    Console.Out.WriteLine("!!! local interaction detached; restarting (server.Shutdown() to shut down server)...");
                }
            }
        }
예제 #3
0
파일: ServerProxy.cs 프로젝트: vogon/nomic
 internal ServerProxy(Repl repl)
 {
     this._repl = repl;
 }