如何识别TCP客户端的带宽速率

发布于 2024-10-17 20:47:18 字数 205 浏览 5 评论 0原文

我正在从 C# 服务器应用程序向客户端发送批量数据。不同的客户端可能有不同数量的可用带宽。例如,某些客户端可能使用拨号、宽带等。

低带宽客户端将无法快速获取我的数据,这可能会导致我的服务器应用程序阻塞。

如果未成功接收数据,我将重试向客户端发送 5 次。我需要通过跟踪客户端的带宽速率来限制服务器发送的数据。

如何在C#中确定接收客户端的带宽速率?

I'm sending bulk data to client from my C# server application. Different clients may have different amounts of bandwidth available. For example, some clients may be using dial-up, broadband, etc.

A low-bandwidth client will be unable to get my data quickly, which may cause blocking in my server application.

I'm retrying the send 5 times to clients, if the data is not successfully received. I need to restrict data send by my server by tracking the bandwidth rate of clients.

How can I determine the bandwidth rate of receiving client in C# ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吃素的狼 2024-10-24 20:47:18

这不是一个很好的方法,因为任何特定客户端的带宽都可能发生巨大变化。

相反,实施一些流量控制(TCP 为您提供了此功能)。也许您唯一需要做的就是将套接字配置为非阻塞 I/O,这样当传输窗口填满时它会给出错误消息,而不是阻塞您的线程。

That's not a very good approach, since bandwidth to any particular client can change dramatically.

Instead, implement some flow control (TCP provides this for you). Probably the only thing you need to do is configure your socket for non-blocking I/O, so it gives an error message when the transmit window fills instead of blocking your thread.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文