コード例 #1
0
        // Deny client with http error message
        private async Task <bool> RejectClient(ConnectionStream stream, string errorMessage)
        {
            byte[] errorData = Encoding.UTF8.GetBytes(HttpErrorTemplate
                                                      .Replace("{Content}", errorMessage)
                                                      .Replace("{ContentType}", "text/plain")
                                                      .Replace("{ContentLength}", errorMessage.Length.ToString()));
            await stream.WriteAsync(errorData, errorData.Length);

            stream.Dispose();
            return(false);
        }
コード例 #2
0
ファイル: Protocol.cs プロジェクト: webconfig/FrameWork
 public void Dispose()
 {
     stream.Dispose();
 }