Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: SOAP client (Android, Samsung) using Indy getting Socket Error #111


This question is answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Dec 12, 2017 11:23 PM Last Post By: Jan Venema
Jan Venema

Posts: 5
Registered: 10/29/11
SOAP client (Android, Samsung) using Indy getting Socket Error #111  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 12, 2017 2:32 AM
I've created a mobile application (Android, iOS) which connects to a SOAP server by HTTPRIO client component.

Connection is secured by SSL (by providing libcrypto.so and libssl.so for Android from vulcan, including IdOpenSSLSetLibPath etc.).
On a lot of devices this works like a charm. But on a lot of Samsung devices we get a Socket Error #111.

* disabling SSL (client + server) makes no effect
* even when OpenSSL-libs arent deployed we get the 111 socket error (so before we should get error that libs are missing).
* SOAP-server makes no effect (I've tested on a couple of test-servers available in the internet too).
* Using Delphi 10.1 Berlin update 2

It sounds like a Samsung specific situation (Knox?) where device itself cancels the communication.

1) Does anyone recognizes this behavior?
2) How can we fix this?
2a) use a different client library which doesn't depend on Indy? Do you have a suggestion what components should be used?

Many thanks in advance!
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: SOAP client (Android, Samsung) using Indy getting Socket Error #111
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 12, 2017 10:28 AM   in response to: Jan Venema in response to: Jan Venema
Jan Venema wrote:

On a lot of devices this works like a charm. But on a lot of Samsung
devices we get a Socket Error #111.

That error is ECONNREFUSED. That has nothing to do with SSL. Your TCP
socket connection is being refused by the target machine, usually
because either:

1. you are trying to connect to a port that is not open

2. the port is open, but hass too many pending connections

3. a firewall is blocking the connection

* disabling SSL (client + server) makes no effect
* even when OpenSSL-libs arent deployed we get the 111 socket error

Right, because this is not an SSL issue.

--
Remy Lebeau (TeamB)
Jan Venema

Posts: 5
Registered: 10/29/11
Re: SOAP client (Android, Samsung) using Indy getting Socket Error #111  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 12, 2017 11:23 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Hi Remy,

Thanks for you response.

I've figured it out.
Because of iOS IPv6-only network restrictions I had some code to try to form a IPv6 host address.

TIdStack.IncUsage;
    IdURI := TIdURI.Create(Url);
    try
      try
        GStack.ResolveHost(IdURI.Host, TIdIPVersion.Id_IPv6);
        IdURI.IPVersion := TIdIPVersion.Id_IPv6;
      except
        IdURI.IPVersion := TIdIPVersion.Id_IPv4; // Just in case.
      end;
 
      // Put it back together.
      Result := IdURI.GetFullURI([]);
    finally
      FreeAndNil(IdURI);
      TIdStack.DecUsage;
    end;


Apparently, on all Android devices where connection could be established, we got into the exception-part thus returning the IPv4 address.
But on some Samsung devices this code runs without exception and returning the IPv6 addreess (like the iOS devices).
But the Samsungs couldn't connect by this IPv6 address (while iOS devices could).

I've 'solved' this by only running this code for iOS by conditionals.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02