网络测试 NetTest
'内部函数:网络测试
'先测试本机网络系统状况
Select Case
sqfun.GetInternetConStatus.GetNetConStatus(args(0)) 'args(0)----网址
Case 1
Return
"没有网络"
Case 2
Return
"采用调制解调器上网,网络不通"
Case 3
Return
"采用网卡上网,网络不通"
Case 4
Return
"采用调制解调器上网,已连通"
Case 5
Return
"采用网卡上网,已连通"
End Select
MessageBox.Show("网络线路中1414141员!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
'网络状态监测
'Dim str As DataRow = DataTables("设置").DataRows(0)
'Dim ftp1 As new ftpclient
'ftp1.host= str("IP")
'ftp1.Port= str("Port")
'ftp1.Account = str("Account")
'ftp1.password = str("Password")
'Dim s As String =
"Provider=SQLOLEDB.1;Password=" & str("BasePassword")
& ";Persist Security Info=True;User ID=" &
str("User") & ";Initial Catalog=" & str("BaseName")
& ";Data Source =" & str("IP")
'GetConfigValue("DataSource","")
'Dim form As String = Args(0) '这个参数可以取消
'Forms(Form).Text = "正在连接网络,需要1分钟左右,请稍候......"
If TryConnectHost(args(0)) = False OrElse
Network.Ping(args(0)) = False Then '只加了这一句话
'因为TryConnectHost只判断IP地址是否可以解析,局域网的所有IP都是可以解析的,所以加了Ping命令.
'
Forms(Form).Text = "网络线路中断或服务器拒绝访问,系统将退出,请联系管理员!"
MessageBox.Show("网络线路中断或服务器拒绝访问,请联系管理员!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
Return
"False"
'ElseIf ftp1.Connect = False
'
Forms(Form).Text = "FTP服务器拒绝访问,请联系管理员!"
'
MessageBox.Show("FTP服务器拒绝访问,请联系管理员!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
' Return
"False"
'Else
' try
' Dim conn
As ADODB.Connection
' conn = New
ADODB.Connection
'
conn.ConnectionString = s
' conn.Open
'
Forms(Form).Text = Forms(Form).Name
' Return
"True"
' conn.close
' Catch ex As
Exception
'
Forms(Form).Text = Err.Description
'
MessageBox.Show("SQL数据库" & Err.Description & "请联系管理员!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
' Return
"False"
' End try
End If