public AcceptRequest ( |
||
reader | ||
Résultat | System.Threading.Tasks.Task |
private async void HandleRequest(StreamSocket socket) { var reader = new DataReader(socket.InputStream) { InputStreamOptions = InputStreamOptions.Partial }; var writer = new DataWriter(socket.OutputStream) { UnicodeEncoding = UnicodeEncoding.Utf8 }; var acceptedRequest = new AcceptedRequest(); await acceptedRequest.AcceptRequest(reader); string response; try { var commandRespnose = this.requestHandlerFunc(acceptedRequest.Request, acceptedRequest.Content); response = HttpResponseHelper.ResponseString(commandRespnose.HttpStatusCode, commandRespnose.Content); } catch (NotImplementedException ex) { response = HttpResponseHelper.ResponseString(HttpStatusCode.NotImplemented, ex.Message); } writer.WriteString(response); await writer.StoreAsync(); socket.Dispose(); if (this.ShouldStopAfterResponse) { this.Stop(); } }
private async void HandleRequest(StreamSocket socket) { var reader = new DataReader(socket.InputStream) { InputStreamOptions = InputStreamOptions.Partial }; var writer = new DataWriter(socket.OutputStream) { UnicodeEncoding = UnicodeEncoding.Utf8 }; var acceptedRequest = new AcceptedRequest(); await acceptedRequest.AcceptRequest(reader); string response; try { var commandRespnose = this.requestHandlerFunc(acceptedRequest.Request, acceptedRequest.Content); response = HttpResponseHelper.ResponseString(commandRespnose.HttpStatusCode, commandRespnose.Content); } catch (NotImplementedException ex) { response = HttpResponseHelper.ResponseString(HttpStatusCode.NotImplemented, ex.Message); } writer.WriteString(response); await writer.StoreAsync(); socket.Dispose(); if (this.ShouldStopAfterResponse) { this.Stop(); } }