-4
我已经使用C#和Microsoft API编写了一个程序,显示您的下载量,但它并未告诉我下载的正确大小,例如:如果我下载了10 MB文件,该程序显示11 MB已下载。
我也在网络状态窗口中检查,仍然告诉我,就像我的程序。
为什么? ISP中的其他软件的工作方式与我拥有的相同吗?下载的大小超过了真实
objIPInterfaceStatistics2 = objNetworkInterface[numberinterface].GetIPStatistics();
long newBytesreceived;
newBytesreceived = objIPInterfaceStatistics2.BytesReceived;
if (checkdata == true)
{
checkdata = false;
newBytesreceived = 0;
}
long newUsage = newBytesreceived - oldBytesreceived2;
trafficusage += newUsage;
float converttrafficusage = trafficusage/1000000;
oldBytesreceived2 = objIPInterfaceStatistics2.BytesReceived;
worker.ReportProgress((int)Math.Ceiling(converttrafficusage));
Thread.Sleep(1000);
难道我们只是为了想象一下你写的代码执行和如何/如果你已经有了有问题?请尝试创建某种类型的[mcve],如果您需要帮助来确定您做错了什么。 –
您需要考虑网络开销 – ChrisBint
您确定他们使用的是“度量”吗?他们可能会向你展示MibiBytes上的大小而不是MegaBytes – arracso