NegotiateStream.BeginRead メソッド
アセンブリ: 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
戻り値
非同期操作のステータスを示す IAsyncResult オブジェクト。


暗号化、署名、または暗号化と署名が有効になっている場合、読み取り操作では基になるストリームからのデータの読み取り、データの整合性チェック、データの復号化が行われます。データの暗号化や署名などのセキュリティ サービスが使用されていない場合、このメソッドは基になるストリームで非同期の読み取り操作を開始します。
このメソッドは、非同期で実行され、操作の実行中にブロックしません。操作が完了するまでブロックするには、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(); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からNegotiateStream.BeginRead メソッドを検索する場合は、下記のリンクをクリックしてください。

- NegotiateStream.BeginRead メソッドのページへのリンク