Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIdTCPClient on Android: Can't catch Exception Popup - Socket Error #107
In our Application we offer connect to our server by in 2 ways - by URL (when we are in LTE network) or direct by IP (when we are in same WLAN network as the server).

The app tried to connect the URL first, an when not available (EIdSocketError occours) then we try to connect by direct IP address. On IOS this is working perfect.

On Android, the Indy 10 pop up with a Message Box 'Socket Error 107' when we try to connect to an URL which is not available yet.

We are not able to catch the exception in our code, so our app is not able to handle this.

How can we get the Socket Error 107 instead a popup to the user ??

Here are the relevant code segments. Thanks in advance.

  { Private declarations }
  FClient: TIdTCPClient;

// -----------------------------------------------------------------------------
// Erzeugen
constructor TAppComThread.Create(OnMsgEvent: TComEvent);
  FClient := TIdTCPClient.Create(nil);
  FClient.OnStatus := OnStatus;
  FClient.OnConnected := OnConnected;

  FClient.ConnectTimeout  := c_TcpConnectTimeout;
  FClient.ReadTimeout    := c_TcpReadTimeout;


//  Ausführen
procedure TAppComThread.Execute;


  while not Terminated do


    // Connect now
    if bConnectFlag then
      bConnectFlag := false;
        FClient.Port := c_TcpPortPersonen;
        On E: EIdSocketError Do
          bConnectionFailed := true;
          ReplyMessage('167: No Socket at '+ FClient.Host);

        On E: Exception Do
          bConnectionFailed := true;
          ReplyMessage('172: No Connection to '+ FClient.Host);

Messages In This Thread
TIdTCPClient on Android: Can't catch Exception Popup - Socket Error #107 - by Peter_WB - 06-18-2020, 09:25 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)