开发者

How to check Server down with VB.net?

开发者 https://www.devze.com 2023-04-10 05:31 出处:网络
I want to check Server down with VB.net. but I don\'t understand开发者_如何转开发 about network please help me how to check server down with VB.netYou could do a ping to that computer.

I want to check Server down with VB.net. but I don't understand开发者_如何转开发 about network please help me how to check server down with VB.net


You could do a ping to that computer.

Dim _ping As New Ping
Dim _pingreply = _ping.Send(IpAddress, 2000)
If _pingreply.Status = IPStatus.Success Then
  'server is online
Else
  'server is offline
End If

Of course this will only work if the server allows pings. And will only give you so much information. Consider it a first step.

You need to be careful to set the timeout to an appropriate value. In this case I set it to 2000 milliseconds, which might not be long enough in your case. But the longer you set it the longer the user will have to wait before he knows it is online.

0

精彩评论

暂无评论...
验证码 换一张
取 消