Пример #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();
        }