Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I downloaded the VB 2005 express edition and went right to work checking out the MY namespace for networks.

 

The My.Computer.Network.IsAvailable

 

returns an expected true, so hooking up to the newtork I went about making an applet to ping machines on my network.

 

All appeared to be OK, I can ping with network AND machine up and connected, it seems to work fine. Disconnect the network, still fine. BUT shutting off the target machine STILL doesn't generate any error.

 

Heres the code from MSDN:

 

If My.Computer.Network.Ping("198.01.01.01") Then

MsgBox("Server pinged successfully.")

Else

MsgBox("Ping request timed out.")

End If

 

I presume that the method is determining that a return did occur.

 

When I PING from the command line, I get the correct "Request Timed Out"

response. I think their method has a bug. Has anyone else used this method with success?

 

 

Regards,

 

Gary

  • Administrators
Posted

Never used the Ping from the My namespace - I've always used the Ping class directly. Have you tried specifying a timeout value though?

If My.Computer.Network.Ping("198.01.01.01",30000) Then
   MessageBox.Show("Server pinged successfully.")
Else
   MessageBox.Show("Ping request timed out.")
End If

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
Never used the Ping from the My namespace - I've always used the Ping class directly. Have you tried specifying a timeout value though?

If My.Computer.Network.Ping("198.01.01.01",30000) Then
   MessageBox.Show("Server pinged successfully.")
Else
   MessageBox.Show("Ping request timed out.")
End If

 

The default (IIRC) is 500 milliseconds, pretty tight. I would imagine that the default would cause a false FAILURE rather than a false pass. If that was the case, then setting a longer timeout "should" allow a pass where it wouldn't pass with the default.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...