Remote URL Not Available

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Remote URL Not Available

Monte Goulding via use-livecode
Our app has contains content  "in the package" and content streamed from "the cloud"

It’s a bit new to me dealing with TsNet, latency issues, timeout, and to give the user feedback on status… it's a challenge…So 1 question at a time:

How do you determine that a URL is not available *before* you set a [player object, stream the text, show a slide, pick a YouTube etc]?

One could obvious ping it and test for "404 page not found" , but the server may respond with any number of messages.  Rather than checking all those, in there is way to do this?

put exists(sRemoteURL) into sRemoteURLAvailable
return sRemoteURLAvailable

So if it return "true" ; you can proceed with operations? If not, inform user...

Is there a header that you would get, if the URL were available?

BR

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Remote URL Not Available

Monte Goulding via use-livecode
To see if the server is listening on a given port, use telnet <servername> <portnumber>

You should get some kind of response within a reasonable period of time. If you know the IP of the server use that instead of the name and you can avoid DNS latency. Ping will only tell you if the server is on and accessible.

As far as page not found, I don't think there is an easy way to check if a page is *going* to be available before you go there. But if the server is listening on the correct port, but no delivering pages, the issue is internal with the server, hence the error codes.

Bob S


> On Jun 26, 2018, at 08:02 , Sannyasin Brahmanathaswami via use-livecode <[hidden email]> wrote:
>
> Our app has contains content  "in the package" and content streamed from "the cloud"
>
> It’s a bit new to me dealing with TsNet, latency issues, timeout, and to give the user feedback on status… it's a challenge…So 1 question at a time:
>
> How do you determine that a URL is not available *before* you set a [player object, stream the text, show a slide, pick a YouTube etc]?
>
> One could obvious ping it and test for "404 page not found" , but the server may respond with any number of messages.  Rather than checking all those, in there is way to do this?
>
> put exists(sRemoteURL) into sRemoteURLAvailable
> return sRemoteURLAvailable
>
> So if it return "true" ; you can proceed with operations? If not, inform user...
>
> Is there a header that you would get, if the URL were available?
>
> BR
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Remote URL Not Available

Monte Goulding via use-livecode
Thanks Bob..

For years if been keeping a ping.txt file on the server. It contains "true" which tell me the server is available. Interesting enough, apple does the almost the thing.

That suffices for the server.

I agree that there in no way " to check if a page is *going* to be available" before you go there. I was thinking, if it "is" available, then we check into the header for one "param"  that would be "true".

If we can avoid checking all errors.  Other the hand, error codes is a finite list so possible we can check with the small list of 5,6 errors code.

Brahmanathaswami
 

On 6/26/18, 5:17 AM, "use-livecode on behalf of Bob Sneidar via use-livecode" <[hidden email] on behalf of [hidden email]> wrote:

    To see if the server is listening on a given port, use telnet <servername> <portnumber>
   
    You should get some kind of response within a reasonable period of time. If you know the IP of the server use that instead of the name and you can avoid DNS latency. Ping will only tell you if the server is on and accessible.
   
    As far as page not found, I don't think there is an easy way to check if a page is *going* to be available before you go there. But if the server is listening on the correct port, but no delivering pages, the issue is internal with the server, hence the error codes.
   
    Bob S

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Remote URL Not Available

Monte Goulding via use-livecode
In reply to this post by Monte Goulding via use-livecode
On 6/26/18 10:02 AM, Sannyasin Brahmanathaswami via use-livecode wrote:
> How do you determine that a URL is not available*before*  you set a [player object, stream the text, show a slide, pick a YouTube etc]?
>
> One could obvious ping it and test for "404 page not found" , but the server may respond with any number of messages.  Rather than checking all those, in there is way to do this?

I've used this:

  get url tURL
  put the result into tNetworkErr
  put it into tData

If the result isn't empty then there has been an error. Otherwise, you
can do something with the data in the "it" variable.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Remote URL Not Available

Monte Goulding via use-livecode
"it" almost always containa data.

e.g contains "404 Page Not Found"  

I wondering if we have to parse it for all possible errors?

Or, if there is  just *one* thing that is true, for all "I found the file, here it is" cases



J. Landman Gay wrote:

    I've used this:
   
      get url tURL
      put the result into tNetworkErr
      put it into tData
   
    If the result isn't empty then there has been an error. Otherwise, you
    can do something with the data in the "it" variable.
   
   

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Remote URL Not Available

Monte Goulding via use-livecode
On 06/27/2018 07:34 AM, Sannyasin Brahmanathaswami via use-livecode wrote:
> "it" almost always containa data.
>
> e.g contains "404 Page Not Found"
>
> I wondering if we have to parse it for all possible errors?
>
> Or, if there is  just *one* thing that is true, for all "I found the file, here it is" cases

Try the http getting the remote resource.
Then check the returned http status for a 2xx (or 3xx) status code.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Remote URL Not Available

Monte Goulding via use-livecode
In reply to this post by Monte Goulding via use-livecode
Sannyasin Brahmanathaswami wrote:

 > "it" almost always containa data.
 >
 > e.g contains "404 Page Not Found"
 >
 > I wondering if we have to parse it for all possible errors?

That's the central question of all end-user systems. :)

There may be good reason to check for specific errors and handle them
differently.  Or as browsers do, just report them to the user and let
them figure it out.

How much time to invest in handling specific error conditions will
depend on the app and the nature of the error.


 > Or, if there is  just *one* thing that is true, for all "I found the
 > file, here it is" cases

If the result is empty you should be fine.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Remote URL Not Available

Monte Goulding via use-livecode
On 6/27/18 12:28 PM, Richard Gaskin via use-livecode wrote:
>  > Or, if there is  just *one* thing that is true, for all "I found the
>  > file, here it is" cases
>
> If the result is empty you should be fine.

This. An empty result means the file exists and is accessible, so the
script can continue and use the data in "it". If the result isn't empty
you can report the error to the user, keep a log, have LC put up the
report dialog, or whatever.

The "it" variable will almost always have content. In the case of a
server error, it will contain the html text of the error page. But the
result will have specific info about the error. A server error will
contain the error number and a brief description (i.e., "error 403
Forbidden"), and a connection error will report the type of error
("timeout" for example) so usually there isn't any need to parse the
data in "it".

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode