Ejemplo n.º 1
0
        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));
            }
        }
Ejemplo n.º 2
0
        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)...");
                }
            }
        }
Ejemplo n.º 3
0
 internal ServerProxy(Repl repl)
 {
     this._repl = repl;
 }