Connecting Tech Pros Worldwide Help | Site Map

How to check a network server is available

Li Pang
Guest
 
Posts: n/a
#1: Nov 20 '05
Hi

Anybody knows how to check a network server is available (pingable)

Many thanks in advance.
Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#2: Nov 20 '05

re: How to check a network server is available


* "=?Utf-8?B?TGkgUGFuZw==?=" <anonymous@discussions.microsoft.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>
Cor
Guest
 
Posts: n/a
#3: Nov 20 '05

re: How to check a network server is available


Hi Li Pang,

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.IPHostEntry
hostInfo = System.Net.Dns.GetHostByAddress("xxx.xxx.xxx.xxx") ' a fixed
server IP
MessageBox.Show(hostInfo.HostName)

Cor


Cor
Guest
 
Posts: n/a
#4: Nov 20 '05

re: How to check a network server is available


Hi Li Pang,

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.WebRequest
> Try
> hostInfo = System.Net.Dns.GetHostByAddress("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]


Cor
Guest
 
Posts: n/a
#5: Nov 20 '05

re: How to check a network server is available


Hi Li,

Than this methode is unusable.

Thanks.

Cor[color=blue]
>
> The hostname is populated either the server is available or not.[/color]


Li Pang
Guest
 
Posts: n/a
#6: Nov 20 '05

re: How to check a network server is available


Hi Herfried K. Wagner

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


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#7: Nov 20 '05

re: How to check a network server is available


* "=?Utf-8?B?TGkgUGFuZw==?=" <anonymous@discussions.microsoft.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:

<http://www.remotesoft.com/>
-> "Octopus"

C# -> VB .NET Converters:

<http://www.kamalpatel.net/ConvertCSharp2VB.aspx>
<http://csharpconverter.claritycon.com/Default.aspx>
<http://www.ragingsmurf.com/vbcsharpconverter.aspx>
<http://www.aspalliance.com/aldotnet/examples/translate.aspx>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Cor
Guest
 
Posts: n/a
#8: Nov 20 '05

re: How to check a network server is available


Hi Herfried,

Now I remember me again how I got this code, I translated it.

That was what Li said.

I have dumped it now from my HKW system.

Cor


Paul Clement
Guest
 
Posts: n/a
#9: Nov 20 '05

re: How to check a network server is available


On Fri, 20 Feb 2004 02:56:04 -0800, "Li Pang" <anonymous@discussions.microsoft.com> wrote:

¤ Hi,
¤
¤ Anybody knows how to check a network server is available (pingable)?
¤

See the following MS KB article:

How to ping an IP address by using sockets in Visual Basic .NET
http://support.microsoft.com/default...&Product=vbNET


Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
Li Pang
Guest
 
Posts: n/a
#10: Nov 20 '05

re: How to check a network server is available


The codes in this link work for me
http://msdn.microsoft.com/library/de...ClassTopic.asp
Cor
Guest
 
Posts: n/a
#11: Nov 20 '05

re: How to check a network server is available


Hi Ping,

Thanks for your answer,

Cor


Closed Thread