Results 1 to 5 of 5

Thread: Asynchronous web request to check for internet connectivity.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Manchester
    Posts
    266

    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 FinishWebRequestrequest)

    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

  2. #2
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Asynchronous web request to check for internet connectivity.

    What is the purpose of checking for internet connectivity?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Manchester
    Posts
    266

    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.

  4. #4
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    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.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Manchester
    Posts
    266

    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
  •  



Click Here to Expand Forum to Full Width