Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IdTCPClient on Android: Connecting to non-active network
#1
I am not sure if the Indy system can help here, or that this is a pure Android issue (and forums.embarcadero.com is down again).

Android has an 'Active Network', which is set by the system. I get a notification from the 'ConnectionManager' when Android is changing this 'Active' network.
Problem is that Android claims the active network is "connected" when it has Internet access. NOT when it is in fact connected to a Network!

So I have this situation.
Android is connected to a WIFI network on which runs my Local Database Server. But this WIFI network does NOT have Internet access.
At the same time the Android device is also connected to a 'Mobile' network, which DOES have Internet access.
The ConnectionManager sends a notification that the Active Network is the Mobile network and that the WIFI network is NOT connected (but it is).

My App is aware that on the WIFI my Server is active (because I get a broadcast message from it via the IdUDPServer) on the WIFI network, which includes its IP address).

But when I try to connect to it, this connect request goes out over the Mobile network, NOT to the WIFI network.

So. Is there any way I can force the IdTCPClient to specifically do a 'Connect' to via the WIFI network (of which I can get all details) as opposed to the default 'Active' network?

PS:
I tried to set the BoundIP with the local IP address assigned to the WIFI network; But this does not have any effect:
{code}
IdSSLIOHandlerSocketOpenSSL1 := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
          IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Mode := sslmClient;  // sslmUnassigned
          IdSSLIOHandlerSocketOpenSSL1.SSLOptions.SSLVersions := [sslvTLSv1_2];
          IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Method := sslvTLSv1_2;
          IdSSLIOHandlerSocketOpenSSL1.SSLOptions.VerifyDepth := 0;
          IdSSLIOHandlerSocketOpenSSL1.OnStatusInfo := TDTBEventHandlers.IdSSLIOHandlerSocketOpenSSL1StatusInfo;
          IdSSLIOHandlerSocketOpenSSL1.OnStatus := TDTBEventHandlers.IdSSLIOHandlerSocketOpenSSL1Status;
          IdSSLIOHandlerSocketOpenSSL1.OnVerifyPeer := TDTBEventHandlers.IdSSLIOHandlerSocketOpenSSL1VerifyPeer;
          IdSSLIOHandlerSocketOpenSSL1.PassThrough := true;

          IdTCPClient1.IOHandler := IdSSLIOHandlerSocketOpenSSL1;
          if NetworkData.LocalIP <> '' then
          begin
            IdTCPClient1.BoundIP := NetworkData.LocalIP;
            IdSSLIOHandlerSocketOpenSSL1.BoundIP := NetworkData.LocalIP;
            LocalLog('=== TCPThread.Execute: Connect using BoundIP: '+NetworkData.LocalIP);
          end;
{code}


Thanks, Bart
---
Bart Kindt
CEO and Developer
SARTrack Limited
New Zealand
www.sartrack.nz
Reply


Messages In This Thread
IdTCPClient on Android: Connecting to non-active network - by BartKindt - 04-26-2018, 05:16 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)