On Fri, 23 Feb 2018, Luca Olivetti wrote:

Hello,

the TFpHttpClient has an IoTimeout property, which in turn sets the IOTimeout of its FSocket (TInetSocket), however there's no way to set a connection timeout. I see that even overriding the SocketHandler wouldn't change that, since it's connect is only called *after* the fpconnect call succeeds.
Also, I see no way to interrupt a pending connect from another thread.

My problem is that I'm using it in a thread, and, when I terminate the application, in case the host is not responding/not available, I have to wait the roughly 30 seconds that it takes for the connect to timeout.

I had the same problem with synapse, but there it has been solved several years ago by introducing a connection timeout (besides, I can abort a socket operation from another thread, though it only works under windows).

This is on my todo list. Unfortunately, the way sockets work, this means
putting the socket in non-blocking mode, call connect, and then use select
or some other means to wait till the socket is done with the connect, and
then put the socket again in blocking mode.

So not something to be quickly done in 10 minutes...

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to