Exemple #1
0
        public void StartListen()
        {
            m_TcpListener = new TcpListener(IPAddress.Parse(m_IpAddress), m_Port);

            //开始监听,这里有重载可以设置最大挂起数;
            m_TcpListener.Start();

            while (m_isActive)
            {
                //等待客户端连接;
                TcpClient tcpClient = m_TcpListener.AcceptTcpClient();

                //客户端连接之后,开始对连接数据进行处理;
                HttpProcessor processor = new HttpProcessor(tcpClient, this);
                processor.Process();
            }
        }