コード例 #1
0
 public void listen()
 {
     listener = new TcpListener(port);
     listener.Start();
     while (is_active)
     {
         TcpClient s = listener.AcceptTcpClient();
         consoleManager.playSoynds();
         consoleManager.printDate();
         HttpProcessor processor = new HttpProcessor(s, this);
         Thread thread = new Thread(new ThreadStart(processor.process));
         thread.Start();
         Thread.Sleep(1);
     }
 }
コード例 #2
0
        public  void handleGETRequest(HttpProcessor p)
        {
            //Console.WriteLine("request: {0}", p.http_url);

            string query = (p.http_url).Trim(new Char[] { '/' });
            Console.WriteLine("q = {0}", HttpUtility.UrlDecode(query));

            Parallel.Invoke(
                () => readUsers(),
                () => readNotes()
            );
            

            answerFromServer = new AnswerServer(allNotes, allUsers);

            p.writeSuccess();
            p.outputStream.WriteLine(answerFromServer.getAnswer(query));
        }