在局域网内如何监测是否有外网
我所在公司电脑如果要上外网 是需要通过公司的一个网页填写上网账号后才有外网,每天晚上0:00就会被服务器踢下线,到第二天需要上网,必须再一次登录上网认证页面填写账号与密码电脑才可以上外网。 我想写一个程序来监测是否断网,在网上找了一些代码,经过实际测试,已经断网还是显示有网,通过ping命令测试拼不通IP地址,除非把本地连接断开,就显示网络异常,该公司有100多台内网的主机,请路过的高手指点一下就近问题出现在哪儿?
Private Declare Function timeGetTime Lib "winmm.dll" () As Long Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Sub Form_Load() Command1.Visible = False End Sub Private Sub Timer1_Timer() Winsock1.Close '不管状态,先关闭当前连接 DoEvents '确保关闭操作完成 Winsock1.Connect "183.2.172.185", 80 '连接百度服务器 End Sub Private Sub Timer2_Timer() Command1_Click End Sub Private Sub Command1_Click() If Winsock1.State = sckConnected Then Label1.Caption = "网络正常" Else Label1.Caption = "网络异常" End If End Sub
