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。
asyncResult 不是由调用 BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)创建的。
写入操作失败。
示例
下面的示例演示了一个调用方法来完成异步写入操作。 有关演示如何启动操作的示例,请参阅 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、、BeginAuthenticateAsClientAuthenticateAsServer、AuthenticateAsServerAsync或BeginAuthenticateAsServer方法。
若要同步执行此操作,请使用 Write 该方法。