Esempio n. 1
0
        private async void SocketListener_ConnectionReceived(StreamSocketListener sender, StreamSocketListenerConnectionReceivedEventArgs args)
        {
            if (sender != _socketListener)
            {
                return;
            }

            StreamSocket socket = args.Socket;

            _log.Debug("Incoming connection to {0}:{1} from {2}...", socket.Information.LocalAddress.DisplayName, socket.Information.LocalPort, socket.Information.RemoteAddress.DisplayName);

            HttpRequest request = await HttpRequest.GetHttpRequest(args.Socket);

            if (request == null)
            {
                return;
            }

            _log.Info("Received request from {0}: {1}", socket.Information.RemoteAddress.DisplayName, request.Uri.PathAndQuery);

            RequestReceived.Raise(this, new HttpRequestEventArgs(request));
        }