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

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

NegotiateStream.BeginRead メソッド

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

ストリームからデータ読み取り指定した配列格納する非同期読み取り操作開始します

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

Public Overrides Function
 BeginRead ( _
    buffer As Byte(), _
    offset As Integer, _
    count As Integer, _
    asyncCallback As AsyncCallback, _
    asyncState As Object _
) As IAsyncResult
Dim instance As NegotiateStream
Dim buffer As Byte()
Dim offset As Integer
Dim count As Integer
Dim asyncCallback As AsyncCallback
Dim asyncState As Object
Dim returnValue As IAsyncResult

returnValue = instance.BeginRead(buffer, offset, count, asyncCallback, asyncState)
public override IAsyncResult BeginRead (
    byte[] buffer,
    int offset,
    int count,
    AsyncCallback asyncCallback,
    Object asyncState
)
public:
virtual IAsyncResult^ BeginRead (
    array<unsigned char>^ buffer, 
    int offset, 
    int count, 
    AsyncCallback^ asyncCallback, 
    Object^ asyncState
) override
public IAsyncResult BeginRead (
    byte[] buffer, 
    int offset, 
    int count, 
    AsyncCallback asyncCallback, 
    Object asyncState
)
public override function BeginRead (
    buffer : byte[], 
    offset : int, 
    count : int, 
    asyncCallback : AsyncCallback, 
    asyncState : Object
) : IAsyncResult

パラメータ

buffer

ストリームから読み取ったバイト受け取Byte 配列

offset

このストリームから読み取ったデータ格納開始する位置を示す、buffer 内のインデックス番号が 0 から始まる位置

count

ストリームから読み取る最大バイト数。

asyncCallback

読み取り操作完了時に呼び出すメソッド参照する AsyncCallback デリゲート

asyncState

読み取り操作に関する情報格納するユーザー定義のオブジェクト。このオブジェクトは、操作完了時に asyncCallback デリゲート渡されます。

戻り値
非同期操作ステータスを示す IAsyncResult オブジェクト

例外例外
例外種類条件

ArgumentNullException

buffernull 参照 (Visual Basic では Nothing) です。

ArgumentException

offset が 0 未満です。

または

offsetbuffer長さ超えてます。

または

offsetcount加算した値が、buffer長さ超えてます。

IOException

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

または

暗号化使用されていますが、データ復号化できませんでした

NotSupportedException

既に実行中の読み取り操作存在します

ObjectDisposedException

このオブジェクト閉じられています。

InvalidOperationException

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

解説解説

暗号化署名、または暗号化署名有効になっている場合読み取り操作では基になるストリームからのデータ読み取りデータ整合性チェックデータ復号化が行われますデータ暗号化署名などのセキュリティ サービス使用されていない場合、このメソッドは基になるストリーム非同期読み取り操作開始します

このメソッドは、非同期実行され操作実行中にブロックしません。操作完了するまでブロックするには、Read メソッド使用します

非同期読み取り操作は、EndRead メソッド呼び出して終了させる必要があります通常、このメソッドasyncCallback デリゲートによって呼び出されます。非同期プログラミング モデル使用法詳細については、「同期メソッド非同期呼び出し」を参照してください

NegotiateStream クラスは、複数読み取り操作同時実行サポートしていません。同じストリームで既に読み取り操作実行中であるときに、別の読み取り操作開始しようとすると、NotSupportedException 例外スローさます。

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

使用例使用例

非同期読み取り操作開始するコード例次に示します。このコード例は、NegotiateStream クラストピック取り上げているコード例一部分です。

public static void AuthenticateClient(TcpClient
 clientRequest)
{
    NetworkStream stream = clientRequest.GetStream(); 
    // Create the NegotiateStream.
    NegotiateStream authStream = new NegotiateStream(stream, false);
 
    // Save the current client and NegotiateStream instance 
    // in a ClientState object.
    ClientState cState = new ClientState(authStream, clientRequest);
    // Listen for the client authentication request.
    authStream.BeginAuthenticateAsServer (
        new AsyncCallback(EndAuthenticateCallback),
        cState
        );
    // Wait until the authentication completes.
    cState.Waiter.WaitOne();
    cState.Waiter.Reset();
    authStream.BeginRead(cState.Buffer, 0, cState.Buffer.Length, 
           new AsyncCallback(EndReadCallback), 
           cState);
    cState.Waiter.WaitOne();
    // Finished with the current client.
    authStream.Close();
    clientRequest.Close();
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
NegotiateStream クラス
NegotiateStream メンバ
System.Net.Security 名前空間


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS