Obtaining Current Network Rate

2019-09-03 08:10发布

问题:

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.

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

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.

Edit

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.

回答1:

I found a GUI application that offers the same functionality:

GUI Application Source

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.