以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]网络丢包判断 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=154460) |
-- 作者:haotinghua -- 发布时间:2020/9/15 16:40:00 -- [求助]网络丢包判断 实际中,遇到网速极不稳定,希望在判断网速很低时,进行加载限制,如何判断网速不通畅? TryConnectHost是判断解析和连接的。希望判断网速很低时。 |
-- 作者:有点蓝 -- 发布时间:2020/9/15 16:56:00 -- 不好判断,速度不是固定的,有可能这一秒查询是2M,下一秒查询就是1k了。如果要不停的查询,也是很耗资源的 Dim adapters() As System.Net.NetworkInformation.NetworkInterface = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces() For Each adapter As System.Net.NetworkInformation.NetworkInterface In adapters Output.Show("描述:" & adapter.Description) Output.Show("标识符:" & adapter.Id) Output.Show("名称:" & adapter.Name) Output.Show("类型:" & adapter.NetworkInterfaceType) Output.Show("速度:" & adapter.Speed * 0.001 * 0.001 & "M") Output.Show("操作状态:" & adapter.OperationalStatus) Output.Show("MAC 地址:" & adapter.GetPhysicalAddress().Tostring) Dim ipp = adapter.GetIPProperties().UnicastAddresses For Each ip As System.Net.NetworkInformation.UnicastIPAddressInformation In ipp If ip.Address.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork Output.Show("IP 地址: " & ip.Address.ToString()) Exit For End If Next Next |