.NET NetworkStream.EndWrite()字节写字节、NET、NetworkStream、EndWrite

2023-09-04 00:59:46 作者:浅巷

MSDN文档中明确指出:

The MSDN documentation clearly states that:

获取的NetworkStream后,你可以调用EndWrite方法   成功完成发送操作,并返回数量   发送字节。

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

重点煤矿。

然而,它没有返回值(空):

However, it returns nothing (void):

public override void EndWrite(
    IAsyncResult asyncResult
)

我缺少的东西,或者这是一个错字( EndRead()并返回字节读取)。?

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

推荐答案

您不会错过任何东西,它是一个文档错误。通过复制可能诱发/粘贴EndRead文章。凡非常很重要。你已经知道有多少字节被写了,所有的人。

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.

 
精彩推荐
图片推荐