1

Using Delphi (FMX) and Indy10.

I am trying to connect to a Database Server on a WIFI Network, which is in fact Connected, but does not have Internet access.

The Android ConnectionManager claims the WIFI is NOT connected, when a Mobile Network is connected. When this Mobile Network goes in and out connection (bad coverage) the ConnectionManager keeps flipping the WIFI Network as being Connected and Not Connected, while all the time the WIFI is in fact connected (but has no Internet access).

I must make a stable connection to the WIFI network to my Database Server, regardless of the invalid WIFI status ConnectionManager, and including when the Mobile network is in fact connected, as I need the WIFI based Database Server. This means I cannot use the 'Active Network'.

How do I do this?

4
  • You already asked this same question on AToZed's Indy forum, and I already answered it there: atozed.com/forums/showthread.php?tid=126 Apr 28, 2018 at 14:46
  • Yes, but I am also trying to find an Android -specific answer to the situation, which IMHO is a major inconsistency in the way Android deals with switching Networks. I am will now do more testing based on your answers in the atozed forum, but as I already said, I have not been able to make it work by trying to connect the outgoing socket using the (known) IP address of the connected WIFI network, and the (unknown) Port of that WIFI network.
    – Bart Kindt
    Apr 28, 2018 at 18:46
  • There is no "unknown port". YOU pick the local port that you WANT to use, or just leave it 0 to let the OS pick one for you. What is important in this situation is telling the socket which network interface to bind to locally, and that has nothing to do with ports. You bind to the interface by its IP address, or its name/index, as I explained in my AToZed forum answer Apr 28, 2018 at 20:13
  • 3
    Mobile devices shouldn't even attempt to keep and maintain a live database connection. You should seriously consider a stateless connection, typically accomplished by building a REST server. Then you wouldn't even have to worry about problems like this. Apr 28, 2018 at 20:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.