-
Jan 1st, 2013, 11:13 AM
#1
Thread Starter
Hyperactive Member
Asynchronous web request to check for internet connectivity.
I've been trying to work on this using various online sources for about 6 hours and can't get my head around it.
I'm building a Windows 8 phone application using VS2012 and simply trying to send a request to a URL and receive back a response to identify whether or not we have internet connectivity. So far, I call the following subroutine:
PHP Code:
Sub intnow()
Dim uri As New System.Uri("http://www.aol.com")
Dim request As WebRequest = WebRequest.Create(uri)
request.BeginGetResponse(AddressOf FinishWebRequest, request)
End Sub
I then have a subroutine called FinishWebRequest within which I am expecting a response. I simply don't know where to go from here. How do I parse the HTTP response? Ps: I have to use BeginGetResponse as it is the only method Windows 8 supports in this class.
Many Thanks,
Jordan
-
Jan 1st, 2013, 11:57 AM
#2
Re: Asynchronous web request to check for internet connectivity.
What is the purpose of checking for internet connectivity?
-
Jan 1st, 2013, 12:02 PM
#3
Thread Starter
Hyperactive Member
Re: Asynchronous web request to check for internet connectivity.
My application stores data which needs sending to a server. However, if a phone is in a bad coverage area or temporarily does not have internet access, I need to know about it so that the data can be queued up to be sent as soon as a connection becomes available.
-
Jan 1st, 2013, 12:08 PM
#4
Re: Asynchronous web request to check for internet connectivity.
The code to send the data needs to be written to take care of any errors that may occur, including no connectivity. There is no point in checking before sending, as you may lose connectivity between the time you check and the time you send.
-
Jan 1st, 2013, 12:22 PM
#5
Thread Starter
Hyperactive Member
Re: Asynchronous web request to check for internet connectivity.
Fair point. This is part of what I am trying to establish. I cannot work out how to send a HTTP request asynchronously and receive back a response.
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
|