gnappi Posted March 11, 2006 Posted March 11, 2006 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 Quote
Administrators PlausiblyDamp Posted March 11, 2006 Administrators Posted March 11, 2006 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 Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
gnappi Posted March 11, 2006 Author Posted March 11, 2006 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.