Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > How can i check the net status?
 

How can i check the net status?

How can i check the net status?

such as connect,or disconnect to the net
MigrationUser 1  Saturday, April 02, 2005 2:35 AM
Can you elaborate alittle more? So we could provide a good solution.

If in your case you have a smart client that interacts with a ws. You can do something like this to check to see if its alive.

<CODE>
public static HttpStatusCode GetURLStatus (string strURL)

{

HttpWebResponse myHttpWebResponse;

try

{

// Create a web request for the given URL.

HttpWebRequest myHttpWebRequest = (HttpWebRequest)
WebRequest.Create(strURL);

// Get the associated response for the above request.

myHttpWebResponse = (HttpWebResponse) myHttpWebRequest.GetResponse();

myHttpWebResponse.Close();

}

catch(WebException we)

{

return ((HttpWebResponse)we.Response).StatusCode;

}

return myHttpWebResponse.StatusCode;

}
</CODE>
MigrationUser 1  Friday, April 15, 2005 12:09 PM
Another way is to use windows  API call to WinInet. It has the best response time but could be less reliable if the IE isn't configurated properly.
MigrationUser 1  Tuesday, May 31, 2005 2:49 AM

You can use google to search for other answers

Custom Search

More Threads

• The small report screen doesn't work
• Error compiling
• Error on compiling and running taskvision
• Planning Development Process
• TaskListControl
• possible changes to Computer settings
• draw a waveform
• cannot log in with jdoe & welcome
• TaskVision - Source code installation help needed
• Genetic algorithms in Terrarium