Share via


NegotiateStream.EndWrite(IAsyncResult) Metoda

Definice

Ukončí asynchronní operaci zápisu, která byla zahájena voláním .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)

Parametry

Výjimky

asyncResult je null.

AsyncResult nebyl vytvořen voláním metody BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object).

Neexistuje žádná operace zápisu čekající na dokončení.

-nebo-

K ověření nedošlo.

Operace zápisu se nezdařila.

Příklady

Následující příklad ukazuje metodu, která je volána k dokončení asynchronní operace zápisu. Příklad, který ukazuje spuštění operace, najdete v tématu 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 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

Poznámky

Pokud se operace nedokončila, tato metoda blokuje, dokud se nedokončila.

Tuto metodu nelze volat, dokud se úspěšně neověříte. Pokud chcete provést ověření, zavolejte jednu z AuthenticateAsClientmetod , AuthenticateAsClientAsync, BeginAuthenticateAsClient, AuthenticateAsServer, AuthenticateAsServerAsyncnebo BeginAuthenticateAsServer .

Pokud chcete tuto operaci provést synchronně, použijte metodu Write .

Platí pro