以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  怎样检测网络速度呢  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=84997)

--  作者:Exon_Liang
--  发布时间:2016/5/15 9:14:00
--  怎样检测网络速度呢

请教怎样在Foxtable程序中检测网络速度呢?先多谢了!


--  作者:xiaoohoo
--  发布时间:2016/5/15 9:48:00
--  
你的问题描述的还不清楚,是宽带连接速率还是实时网络速度。
实时网速取决于你与服务器。


--  作者:大红袍
--  发布时间:2016/5/15 22:42:00
--  

可以尝试ping的速度

 

Dim p As new Process()
p.StartInfo.FileName = "cmd.exe"
p.StartInfo.UseShellExecute = False \'关闭Shell的使用
p.StartInfo.RedirectStandardInput = True \'重定向标准输入
p.StartInfo.RedirectStandardOutput = True \'重定向标准输出
p.StartInfo.RedirectStandardError = True \'重定向错误输出
p.StartInfo.CreateNoWindow = True \'设置不显示窗口
p.Start()
p.StandardInput.WriteLine("ping www.baidu.com")
p.StandardInput.WriteLine("exit")

Dim str As String = p.StandardOutput.ReadToEnd()
msgbox(str)


Dim mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=平均 = )[0-9]+")
If mc.count = 0 Then
    msgbox("连不上")
Else
    msgbox(mc(0).value)
end if


--  作者:Exon_Liang
--  发布时间:2016/5/17 9:16:00
--  
多谢大红袍!