获取当前网络速率 [英] Obtaining Current Network Rate

查看:38
本文介绍了获取当前网络速率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取下载/上传的当前网络传输速率.这是针对 C++ 游戏服务器 DLL 的,其主要目标是最好地预测延迟上限,以便在延迟过高时将玩家踢出服务器.基本上,玩家的ping会影响他们动作的流畅性,更高的延迟会导致更多的动作延迟,这意味着如果它变得太高,我们需要摆脱玩家.这主要是为了让玩家开心.

I would like to obtain the current network transfer rate of download/upload. This is for a C++ gameserver DLL and the primary objective of this is to best predict the upper-latency limit to kick players from the server, when their latency is too high. Basically, a players' ping influences the fluency of their movements, and higher latency leads to more delayed movement, meaning that we need to get rid of the player if it becomes too high. This is to mainly keep players happy.

通过游戏服务器的内部函数我可以得到内部进程上传/下载速率,但我无法得到Windows'.

Via the internal functions of the gameserver I can get the internal process upload/download rates, but I cannot get Windows'.

我几乎到处寻找,并且断断续续地这样做了好几个月.我能找到的唯一解决方案不起作用,其余的都是针对 Linux 的.支持的平台(如果重要的话)是 Windows Server 2008 R2 和 Windows 7.编译器是 Microsoft Visual Studio Ultimate 2013 的默认编译器.

I've looked pretty much everywhere, and have done so on-and-off for quite a few months. The only solutions I can find don't work, and the rest are specific to Linux. The supported platforms (if it matters) are Windows Server 2008 R2 and Windows 7. The compiler is Microsoft Visual Studio Ultimate 2013's default compiler.

编辑

忘了说我的游戏服务器DLL最终会运行在一个不少于四个IP的专用服务器上,所以它需要能够测量所有IP的连接上传/下载(以当前速率).

Forgot to mention that my gameserver DLL will eventually be running on a dedicated server with no less than four IPs, so it needs to be able to measure the connection upload/download (at the current rate) for all the IPs collectively.

推荐答案

我发现了一个提供相同功能的 GUI 应用程序:

I found a GUI application that offers the same functionality:

GUI 应用程序源

我想我应该能够从这个项目中提取必要的库,然后在我自己的项目中使用它们.由于我的 IP 都使用相同的 1GBPS 网络接口,因此它应该能够很好地满足我的要求.

I guess that I should be able to extract the necessary libraries from this project, then use them in my own project. As my IPs all use the same 1GBPS network interface, it should be able to work to my requirements fine.

这篇关于获取当前网络速率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆