Beispiel #1
0
        /// <summary>
        /// Async callback that processes new connections.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        void ProcessAccept(object sender, SocketAsyncEventArgs args)
        {
            SockAccept((Socket)sender);

            if (args.SocketError == SocketError.Success)
            {
                var newClient = args.AcceptSocket;
                var reader    = new HttpRequestReader(newClient, MaxBodySize);
                reader.ReadComplete += ProcessRequest;
                reader.HttpError    += ProcessHttpError;
                reader.AsyncReadRequest();
            }
            args.Dispose();
        }
Beispiel #2
0
        /// <summary>
        /// Async callback that processes new connections.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        void ProcessAccept(object sender, SocketAsyncEventArgs args)
        {
            SockAccept((Socket)sender);

            if (args.SocketError == SocketError.Success)
            {
                var newClient = args.AcceptSocket;
                var reader = new HttpRequestReader(newClient, MaxBodySize);
                reader.ReadComplete += ProcessRequest;
                reader.HttpError += ProcessHttpError;
                reader.AsyncReadRequest();
            }
            args.Dispose();
        }