NegotiateStream.Read メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > NegotiateStream.Read メソッドの意味・解説 

NegotiateStream.Read メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

このストリームからデータ読み取り指定した配列格納します

名前空間: System.Net.Security
アセンブリ: System (system.dll 内)
構文構文

例外例外
例外種類条件

IOException

読み取り操作失敗しました

InvalidOperationException

認証が行われていません。

NotSupportedException

Read 操作は既に実行されています。

解説解説

このメソッドは、count指定した最大バイト現在のストリームから読み取りbuffer 内の offset で始まる位置格納します

このメソッドは、正常に認証されるまで呼び出すことはできません。認証するには、AuthenticateAsClient、BeginAuthenticateAsClient、AuthenticateAsServer、または BeginAuthenticateAsServer のいずれかメソッド呼び出します。

この操作非同期実行するには、BeginRead メソッド使用します

使用例使用例

NegotiateStream から読み取るコード例次に示します

public static void AuthenticateClient(TcpClient
 clientRequest)
{
    NetworkStream stream = clientRequest.GetStream(); 
    // Create the NegotiateStream.
    NegotiateStream authStream = new NegotiateStream(stream, false);
    // Perform the server side of the authentication.
    authStream.AuthenticateAsServer();
    // Display properties of the authenticated client.
    IIdentity id = authStream.RemoteIdentity;
    Console.WriteLine("{0} was authenticated using {1}.",
 
        id.Name, 
        id.AuthenticationType
        );
    // Read a message from the client.
    byte [] buffer = new byte[2048];
    int charLength = authStream.Read(buffer, 0, buffer.Length);
    string messageData = new String(Encoding.UTF8.GetChars(buffer,
 0, buffer.Length));
   
    Console.WriteLine("READ {0}", messageData);
    // Finished with the current client.
    authStream.Close(); 
    // Close the client connection.
    clientRequest.Close();
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
NegotiateStream クラス
NegotiateStream メンバ
System.Net.Security 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からNegotiateStream.Read メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からNegotiateStream.Read メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からNegotiateStream.Read メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

NegotiateStream.Read メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



NegotiateStream.Read メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS