示例#1
0
        public HttpClient(TcpClient client, IHandlerFactory handlerFactory)
        {
            _client       = client;
            _inputStream  = new BufferedStream(_client.GetStream());
            _outputStream = _client.GetStream();
            _router       = new HttpRouter(handlerFactory);

            var clientThread = new Thread(Process)
            {
                IsBackground = true
            };

            clientThread.Start();
        }
示例#2
0
        public HttpClient(HttpContext context, TcpClient client)
        {
            this._client       = client;
            this.context       = context;
            this._inputStream  = new BufferedStream(this._client.GetStream());
            this._outputStream = this._client.GetStream();
            this._router       = new HttpRouter(); // TODO: extract router instantiation

            var clientThread = new Thread(this.Process)
            {
                IsBackground = true,
            };

            clientThread.Start();
        }