Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IdHttp.ReadTimeout has no affect on Android when https fails
(09-07-2019, 03:01 PM)JayBart Wrote: It uses TIdHTTP accessing a https webpage
I already had set ConnectTimeout:= 2000;
but it still blocked.

The ConnectTimeout is applied only when the socket is actually making the TCP connection to the destination IP address. It does not take into account the time needed to resolve a hostname into an IP address, that is always a blocking operation. Unless you perform your own lookup using TIdDNSResolver or platform-specific API that supports doing the lookup with a timeout.

Have you tried using a packet sniffer/debugger, like Wireshark or Fiddler, to see exactly what stage your client is blocking at? Is it during the TCP handshake? The TLS handshake? The HTTP request/response?

(09-07-2019, 03:01 PM)JayBart Wrote: Setting ReadTimeout:= 8000; helped, it timed out after 11 sec. It was always 3 sec longer than ReadTimeout.
Perfect on Windows!

The ReadTimeout is applied only after the TCP connection is fully established and the TLS handshake is complete, when actually reading application data from the connection.

Note: on Windows only, TIdSSLIOHandlerSocketOpenSSL does force socket-level timeouts via the socket's SO_RCVTIMEO and SO_SNDTIMEO options. It does not do that on other platforms.

(09-07-2019, 03:01 PM)JayBart Wrote: But on Android ReadTimeout did not help , it still blocked forever.

Then most likely the TCP connection, or the TLS handshake, is not fully completing. You need to figure out which.

(09-07-2019, 03:01 PM)JayBart Wrote: I tried Berlin (Indy and Seattle (Indy

The current Indy version is


Messages In This Thread
RE: IdHttp.ReadTimeout has no affect on Android when https fails - by rlebeau - 09-10-2019, 08:34 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)