如何识别TCP客户端的带宽速率
我正在从 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是一个很好的方法,因为任何特定客户端的带宽都可能发生巨大变化。
相反,实施一些流量控制(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.