I need to check the existence of internet connection

  • Thread starter Thread starter balajis
  • Start date Start date
B

balajis

Hi all,
I am consuming a web service from my pocketpc application.
Before consuming web service, I need to check the existence of internet
connection. So how to check if my PocketPC is connected to the internet
(with C#). Sample code available anywhere?

Is there any other easy way to identify this?

Thanks
Balaji N.S
 
I use something like this in my projects

private bool HaveRemoteConnection(

string targethttpAddress = Global.rutaws; // The WS rute
System.Net.WebRequest request
System.Net.WebResponse response

tr

request = System.Net.WebRequest.Create(targethttpAddress)
request.Timeout = 5000
response = request.GetResponse()
request.Abort()
response.GetResponseStream().Close()

catc

return false

finall

response = null

return true
 
Back
Top