My.Computer.Network.Ping Bug

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

When I learned about My.Computer.Network.Ping in VB.Net 2005,
I used it in a program that pings a list of servers.

Something like:

Threshold = CInt(txtThreshold.Text)

If My.Computer.Network.Ping(selectedServer, Threshold) Then


or even like:

If My.Computer.Network.Ping(selectedServer, 2) Then


The thing is that My.Computer.Network.Ping doesn't work correctly with
the suppplied timeout value.

If I ping server A from my desktop or use tracert, I always ways get a 9ms
response time.

When I use My.Computer.Network.Ping and supply a value of 4ms or 2ms,
the ping works when it should not.

When I supply a list of servers, where most of them again have a 9 ms
response time, they all return "true" instead of "false".

When a server is down, the My.Computer.Network.Ping does timeout
and returns "false".

The default for the timeout value is documented as 500ms.

I've seen nothing documented on My.Computer.Network.Ping that doesn't allow
a smaller value.

Maybe there's a limit based on processor speed?

Has anyone actually tried My.Computer.Network.Ping with a value they know
is lower than what a ping returns for a server, say against www.google.com?

Also can you execute My.Computer.Network.Ping(selectedServer, Threshold)
in a loop of selected servers?
Since My.Computer.Network.Ping doesn't allow you to see the elapse time
value it
is using in it's comparison, it almost feels like it is using the value
returned from
a previous execution.
Say server A returns in 1ms, all other iterations of
My.Computer.Network.Ping(selectedServer, Threshold) pass
even though their response times are 9ms.

Any ideas?

Thanks
 
Looking at the documentation, I read the timeout value being the time to
*contact the server*, rather than the complete response time (which is what
you are talking about below).
 
Joseph,

The My class is typical VBNet 2005 (although it can be used in other program
languages).

The language newsgroups are the most active dotnet newsgroups, for VB dotNet
is that
microsoft.public.dotnet.languages.vb

I give you much more change on more answers than here.

You are of course welcome here as many times as you want.

Cor
 
Back
Top