Jump to content

Test for Internet Connection


This topic is 1508 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Does anyone have a suggestion for the best way to test for an Internet connection on FileMaker Go? I'm building a system that will run mostly with a local Go file, but will occasionally connect to a served file for updating data. Simply trying to connect takes forever to fail when there's no Internet connection. Even using `Insert from URL` as suggested by a web page I found during my Googling takes quite a while. I'm looking for a quick way to find out if there's an Internet connection or not, quick in that it doesn't make the user wait too long for the result.

Thanks.

Link to comment
Share on other sites

insert from url into a text field and then check for length of text field > 0 or err 1631.

http://www.filemakertoday.com/filemakergo/4037-filemakergo/filemaker-go-tip-checking-for-an-internet-connection

FYI Iphone will try to use WIFI first then use cellular. If the wifi sucks but it present it will use the sucky connection.

Takes forever to fail?

this method is instantaneous for me on go.

Perhaps you are trying to check a server file?

http://www.soliantconsulting.com/blog/2012/10/testing-whether-database-available-filemaker-server

Edited by Kris M
Link to comment
Share on other sites

Yep, I agree with Kris... Using Insert from URL into a text field works very well... I typically use a very lightweight page to insert, e.g. an html page with nothing but the text "OK" on it... Then use Insert from URL and check that the text field contains the "OK" text, and also check for error code 1631...

Link to comment
Share on other sites

Get(NetworkType) only returns the connection type to the file you currently have opened, in which case, when you use it on a local FileMaker Go file, it returns '0', with no indication of whether or not you will be able to connect successfully to a hosted file.

If you are already connected to a hosted database and use it then it will return '2' for cellular and '3' for WiFi connection...

However, in order to test that the device even has an internet connection before attempting to connect to a hosted file (in order to avoid the lengthy delay whilst Filemaker Go attempts to connect to the hosted file if no internet connection is available), then using Insert from URL seems to work well, providing of course that the URL you are connecting to is online and available....

  • Like 1
Link to comment
Share on other sites

Fair enough.. but a valid internet connection does not mean a valid FMP connection so I think I would probably still want to check against the FM host first.  If you have a valid internet connection with the "insert from url" that does not mean that the FMP connection will actually work and if it does not you'll have to wait for it to resolve anyway...

  • Like 1
Link to comment
Share on other sites

  • 4 years later...

I just try this approach and it worked with really low quantity of data from the web to check it.

Insert from URL [ Select ; With dialog: Off ; Target: $check ; "http://google.com/checkinternet" ] 

If [ Get(LastError) = 1631 ] 
    Set Variable [ $status ; Value: "Disconnected" ] 
Else
    Set Variable [ $status ; Value: "Connected" ] 
End If

Show Custom Dialog [ $Status ] 

 

Why http://google.com/checkinternet? Because it will return a webpage with really low quantity of code.

 

Best regards,
Joao Coutinho

Link to comment
Share on other sites

This topic is 1508 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.