Announcement

Collapse
No announcement yet.

HTTP.TestConnection and HTTPS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • HTTP.TestConnection and HTTPS

    Hi IR Forum, a simple question,
    I'm wrong using this code assuming that Google is based on HTTPS?
    Code:
    connected = HTTP.TestConnection("http://www.google.com", 20, 80, nil, nil);
    Have you some more reliable and simple way?
    TNX!

  • #2
    Code:
    IsConnected = HTTP.TestConnection("http://www.google.com", 20, 80, nil, nil); 
    if (IsConnected == true) then 
    Dialog.Message("Notice", "Internet connection was detected");
    else
    Dialog.Message("Notice", "No Internet connection was detected.");
    end

    Comment


    • #3
      Hi herrin, I already use that code.
      My question is regarding HTTP protocol instead of HTTPS.

      Does HTTP.TestConnection the job anyway or is there a dedicated HTTPS function?
      I'm using Google and it is HTTPS.

      Comment


      • #4
        -port 443 instead of 80
        -to test HTTPS upload a small file on the site and use HTTP.DownloadSecure to retrieve it. (suggestion of ulrich)


        yes it work

        Code:
        [ATTACH]n303429[/ATTACH]

        Comment


        • #5
          Thanks, I will try!

          Comment


          • #6
            The sample project above still uses the built-in HTTP.TestConnection(). A more reliable way to check if there is a working internet connection is using Network Connectivity Status Indicator (NCSI). Below is a sample script to redefine HTTP.TestConnection() using this feature. As vBulletin blocks mentions of the command line interpreter in the body of posts, the Lua script is inserted here as an image and attached as a zipped source.

            Click image for larger version

Name:	SCRN-2019-06-03-01.png
Views:	224
Size:	47.2 KB
ID:	303432

            Add the definition of the custom HTTP.TestConnection() to the globals of your project, and no other modifications to the script is required. If the function returns true, you have working DNS and internet connectivity.

            Ulrich

            Comment


            • #7
              Thank you Ulrich for this pro solution, I placed the script on Global and
              The following on Page1 OnShow
              Code:
              if HTTP.TestConnection() == true then
                 Page.Jump("Page2");
              else
                 Page.Jump("Page3");
              end
              It works very fine and very quick.

              Only a question:
              Will that file, that url, be deleted in the future?

              Comment

              Working...
              X
              😀
              🥰
              🤢
              😎
              😡
              👍
              👎