本文介绍了.NET NetworkStream.EndWrite()字节写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MSDN文档中明确指出:

The MSDN documentation clearly states that:

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

重点煤矿。

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

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.

这篇关于.NET NetworkStream.EndWrite()字节写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 07:36