NegotiateStream.EndWrite(IAsyncResult) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
結束一個以呼叫 為 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)實例。
例外狀況
asyncResult 是 null。
寫入操作失敗了。
範例
以下範例示範一種用於完成非同步寫入操作的方法。 關於啟動操作的範例,請參見 BeginWrite。
' 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
備註
如果操作尚未完成,此方法會阻塞直到完成。
在成功驗證之前,你不能呼叫這個方法。 要驗證,請呼叫其中一個 AuthenticateAsClient、 AuthenticateAsClientAsync、 BeginAuthenticateAsClient、 AuthenticateAsServerAuthenticateAsServerAsync、 或 BeginAuthenticateAsServer 方法。
要同步執行此操作,請使用該 Write 方法。