开发者

How to check Server down with VB.net?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜