nuget包中,没有网络流量的获取方法或者相关方法无效
Closed this issue · 3 comments
mfjiang commented
var networks = NetworkInfo.GetRealNetworkInfos();
for (int i = 0; i < networks.Length; i++)
{
data.Add($"net_work_{i + 1}_ipv4", (networks[i].AddressIpv4.ToString()));
data.Add($"net_work_{i + 1}_ipv6", (networks[i].AddressIpv6.ToString()));
data.Add($"net_work_{i + 1}_total_up_kb", (networks[i].Ipv4Statistics.BytesSent / 1024).ToString());
data.Add($"net_work_{i + 1}_total_down_kb", (networks[i].Ipv4Statistics.BytesReceived / 1024).ToString());
InternetSpeed speed = new InternetSpeed();
networks[i].GetInternetSpeed(ref speed,1000);
data.Add($"net_work_{i + 1}_down_kb", (speed.Received.OriginSize / 1024).ToString());
data.Add($"net_work_{i + 1}_up_kb", (speed.Sent.OriginSize / 1024).ToString());
}
以上代码,speed.Received.OriginSize , speed.Sent.OriginSize 皆是0,请问要怎么取?
nuget 包版本:1.0.3
whuanle commented
抱歉,这部分有bug,我计划改,比较忙,这边没有动手
whuanle commented
计划这周花时间升级到 .net 6,然后写window、linux支持
mfjiang commented
计划这周花时间升级到 .net 6,然后写window、linux支持
3.1 希望也能修复