Page 2 of 2

Re: How to check if there is internet connection?

Posted: Mon Feb 07, 2022 6:08 pm
by FourthWorld
Is the goal to check that the server is up, or to obtain the user's public IP address?

Re: How to check if there is internet connection?

Posted: Mon Feb 07, 2022 6:15 pm
by jacque
I don't know much about it either but if they're using a proxy then I think that's what you'll get back. But that's okay since that's the public facing machine.

Check the result to see if they're connected, or put the request into a try block to catch any errors. IOS has a function to check for connectivity but Android doesn't, so you may as well use the same method for both.

Re: How to check if there is internet connection?

Posted: Mon Feb 07, 2022 6:50 pm
by trevix
@FourthWorld
Both. To check if the mobile device has an internet connection and, if that's the case, obtain its public address.

@ jacque
put the request into a try block to catch any errors
I don't think it will work. If there is no answer, there gonna be no answer for a while.Then a timeout should be used. Don't you think?
IOS has a function to check for connectivity
Really?

Re: How to check if there is internet connection?

Posted: Mon Feb 07, 2022 7:29 pm
by jacque
If there's no connection then you're right. If there are actual errors you may want to catch those too.

IOS has some "reachability" messages and functions. The reachabilityChanged message gives some info about the connection. It's not exactly a check for internet, but close.

Re: How to check if there is internet connection?

Posted: Mon Feb 07, 2022 8:43 pm
by FourthWorld
What will be done with the user's IP address?

Re: How to check if there is internet connection?

Posted: Tue Feb 08, 2022 9:58 am
by trevix
We have a hosted DB for analytics: the IP is used for geographical location of our users

Re: How to check if there is internet connection?

Posted: Tue Feb 08, 2022 10:22 am
by FourthWorld
trevix wrote:
Tue Feb 08, 2022 9:58 am
We have a hosted DB for analytics: the IP is used for geographical location of our users
You don't use the Apache logs for that? They're a treasure trove.

Re: How to check if there is internet connection?

Posted: Tue Feb 08, 2022 10:52 am
by trevix
Didn't even know it existed (uh!). But what a level of complexity!
Anyway, we are a very small startup, our is not a web app, and we collect data of user activities all across the standalone, sending them at launch to a hosted DB.
We started with a Filemaker server running on my living room (!).
The plan is to move data collection to a MySQL DB so as to have a more popular tool to analyze the data.
Programming absorbs most of our time and we have to scale very gradually to the analytic part of our activities.
Any suggestion is welcomed, anyway