|
-
Jun 9th, 2006, 02:47 AM
#1
Thread Starter
Member
[RESOLVED] Can I check the connection status?
Hi,
I want to check the PocketPC whether connection or not...
if the PocketPC can connect to the internet, then the application can be run..
if the pocketpc status is offline, then I enable the user switch on the wifi function!!
-
Jun 9th, 2006, 03:41 AM
#2
Fanatic Member
Re: Can I check the connection status?
if you want to check for an internet connection you will have to try a http request
if you want to check for a network connection you will have to check the device's ip address. (if the ip address is not 127.0.0.1 then its connected to a network via activesync or wireless)
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Jun 9th, 2006, 11:16 PM
#3
Thread Starter
Member
Re: Can I check the connection status?
 Originally Posted by Strider
if you want to check for an internet connection you will have to try a http request
if you want to check for a network connection you will have to check the device's ip address. (if the ip address is not 127.0.0.1 then its connected to a network via activesync or wireless)
Thanks..
but can you give me more hints!!
which method I can use in httprequest!!
-
Jun 10th, 2006, 01:47 AM
#4
Frenzied Member
Re: Can I check the connection status?
Hi,
httpRequest...
VB Code:
Dim Response As WebResponse
Dim ResponseStream As Stream
Dim Request As WebRequest
Connect_To_Server = True
Try
Request = WebRequest.Create("http://www.google.com")
Response = Request.GetResponse
Catch webex As WebException
Connect_To_Server = False
Catch ex As Exception
Connect_To_Server = False
Finally
Cursor.Current = Cursors.Default
If Not IsNothing(Response) Then
Response.Close()
End If
End Try
Connected...
VB Code:
Dim localEndPoint As New IPEndPoint(Dns.Resolve(Dns.GetHostName()).AddressList(0), 0)
If localEndPoint.Address.ToString <> "127.0.0.1" Then
Connected = False
End If
Pete
-
Jun 11th, 2006, 08:49 AM
#5
Thread Starter
Member
Re: Can I check the connection status?
 Originally Posted by petevick
Hi,
httpRequest...
VB Code:
Dim Response As WebResponse
Dim ResponseStream As Stream
Dim Request As WebRequest
Connect_To_Server = True
Try
Request = WebRequest.Create("http://www.google.com")
Response = Request.GetResponse
Catch webex As WebException
Connect_To_Server = False
Catch ex As Exception
Connect_To_Server = False
Finally
Cursor.Current = Cursors.Default
If Not IsNothing(Response) Then
Response.Close()
End If
End Try
Connected...
VB Code:
Dim localEndPoint As New IPEndPoint(Dns.Resolve(Dns.GetHostName()).AddressList(0), 0)
If localEndPoint.Address.ToString <> "127.0.0.1" Then
Connected = False
End If
Pete
it works well!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|