MSDN 文档明确指出:
After obtaining the NetworkStream, you can call the EndWrite method to successfully complete the send operation and return the number of bytes sent.
强调我的。
但是,它什么都不返回(void):
public override void EndWrite(
IAsyncResult asyncResult
)
我是不是遗漏了什么,或者这是一个错字(EndRead()
确实返回读取的字节)。?
最佳答案
你没有遗漏任何东西,这是一个文档错误。可能是由复制/粘贴 EndRead 文章引起的。哪里非常重要。您已经知道写入了多少字节,全部。
关于.NET NetworkStream.EndWrite() 字节写入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17537637/