* "=?Utf-8?B?TGkgUGFuZw= =?=" <anonymous@disc ussions.microso ft.com> scripsit:[color=blue]
> Anybody knows how to check a network server is available (pingable)?[/color]
Sample in C#:
<http://www.c-sharpcorner.com/network/ping.asp>
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Will you try this and message us if it works, I am in doubt, because I
thought that Ken did distribute this, but he did not send it to you.
Dim hostInfo As System.Net.IPHo stEntry
hostInfo = System.Net.Dns. GetHostByAddres s("xxx.xxx.xxx. xxx") ' a fixed
server IP
MessageBox.Show (hostInfo.HostN ame)
If you than test the name of the server it should go is my thought than or
does it give the name anyway from the registry or someting?.
Cor[color=blue]
>
> Your codes work for getting host name, but can't manage if the server is[/color]
not pingable.[color=blue]
>
> Dim hostInfo As System.Net.WebR equest
> Try
> hostInfo = System.Net.Dns. GetHostByAddres s("xxx.xxx.xxx. xxx")
> Catch exc As Exception
> MessageBox.Show (exc.ToString)
> Exit Sub
> End Try
>
> no error catch if the server is disconnected from the network.
>
> Li Pang[/color]
Is PingHost method is available in VB
The pinghost function is similar to Cor's VB codes, and I can't figure out how to manage if the server is not available
* "=?Utf-8?B?TGkgUGFuZw= =?=" <anonymous@disc ussions.microso ft.com> scripsit:[color=blue]
> Is PingHost method is available in VB?
> The pinghost function is similar to Cor's VB codes, and I can't figure
> out how to manage if the server is not available.[/color]
You will have to translate the C# code to VB.NET, for example by using
these converters:
Comment