NegotiateStream.EndWrite(IAsyncResult) メソッド

定義

BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) の呼び出しで開始された、非同期の書き込み操作を終了します。Ends an asynchronous write operation that was started with a call to BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object).

public:
 override void EndWrite(IAsyncResult ^ asyncResult);
public override void EndWrite (IAsyncResult asyncResult);
override this.EndWrite : IAsyncResult -> unit
Public Overrides Sub EndWrite (asyncResult As IAsyncResult)

パラメーター

asyncResult
IAsyncResult

IAsyncResult の呼び出しによって返される BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) インスタンス。An IAsyncResult instance returned by a call to BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)

例外

asyncResultnull です。asyncResult is null.

BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) の呼び出しで asyncResult が作成されませんでした。The asyncResult was not created by a call to BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object).

完了する保留中の書き込み操作がありません。There is no pending write operation to complete.

または-or-

認証が行われていません。Authentication has not occurred.

書き込み操作に失敗しました。The write operation failed.

非同期の書き込み操作を完了するために呼び出されるメソッドの例を次に示します。The following example demonstrates a method that is called to complete the asynchronous write operation. 操作の開始方法を示す例については、「BeginWrite」を参照してください。For an example that demonstrates starting the operation, see BeginWrite.

// The following method is called when the write operation completes.
static void EndWriteCallback( IAsyncResult^ ar )
{
   Console::WriteLine( L"Client ending write operation..." );
   NegotiateStream^ authStream = dynamic_cast<NegotiateStream^>(ar->AsyncState);
   
   // End the asynchronous operation.
   authStream->EndWrite( ar );
}

// The following method is called when the write operation completes.
public static void EndWriteCallback (IAsyncResult ar)
{
    Console.WriteLine("Client ending write operation...");
    NegotiateStream authStream = (NegotiateStream) ar.AsyncState;

    // End the asynchronous operation.
    authStream.EndWrite(ar);
}
' The following method is called when the write operation completes.
Public Shared Sub EndWriteCallback(ar As IAsyncResult)

    Console.WriteLine("Client ending write operation...")
    Dim authStream = CType(ar.AsyncState, NegotiateStream)

    ' End the asynchronous operation.
    authStream.EndWrite(ar)

End Sub

注釈

操作が完了していない場合、このメソッドは、処理が完了するまでブロックします。If the operation has not completed, this method blocks until it does.

が正常に認証されるまで、このメソッドを呼び出すことはできません。You cannot call this method until you have successfully authenticated. 認証するには、AuthenticateAsClientBeginAuthenticateAsClientAuthenticateAsServer、または BeginAuthenticateAsServer メソッドのいずれかを呼び出します。To authenticate, call one of the AuthenticateAsClient, BeginAuthenticateAsClient, AuthenticateAsServer, or BeginAuthenticateAsServer methods.

この操作を同期的に実行するには、Write メソッドを使用します。To perform this operation synchronously, use the Write method.

適用対象