.NET NetworkStream.EndWrite() bytes written

无人久伴 提交于 2019-12-20 01:38:39

问题


The MSDN documentation clearly states that:

After obtaining the NetworkStream, you can call the EndWrite method to successfully complete the send operation and return the number of bytes sent.

Emphasis mine.

However, it returns nothing (void):

public override void EndWrite(
    IAsyncResult asyncResult
)

Am I missing something, or is this a typo (EndRead() does return bytes read).?


回答1:


You are not missing anything, it is a doc bug. Probably induced by copy/pasting the EndRead article. Where it very much does matter. You already know how many bytes were written, all of them.



来源:https://stackoverflow.com/questions/17537637/net-networkstream-endwrite-bytes-written

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!