Is there a way to set the connect timeout of an IpHttpClientChannel?

Is there a way to set the connect timeout of an IpHttpClientChannel?

We have a Timeout property which appears to be the read timeout
Connection timeout seems to be 20 seconds, can this be altered?

Note: We typically want a small connect timeout (e.g. 5 seconds) and a large (read) timeout (e.g. 5 minutes because we have large jobs.)
I haven’t verified if the Timeout parameter does something for the TCP connect attempt

Hi,

we have one Timeout for IpHttpClientChannel :

So it is not possible to control the connect timeout when using that channel?
Or the Timeout property is both used for connect & data read?

Hi,

System.Net.Sockets.Socket hasn’t ConnectTimeout property.

I still would like an answer

How do I set a shorter connect timeout for IpHttpClientChannel (tls enabled).

The connect timeout by the way appears to be different than the Timeout property

With the settings below the exception below is thrown after ~22 seconds. Where does this come from? Can I reduce this?

FYI: I timed the time between start of

this.ClientChannel.Dispatch(\___localMessage);  (in the Login function)

and the finally

Hi,

from HttpClient throwing System.Net.Sockets.SocketException after 21 seconds · Issue #28205 · dotnet/runtime · GitHub

21 seconds is the built-in default for TCP connection timeout on Windows. It is 21 seconds because Windows TCP stack allows for 7 seconds per leg of the 3-leg TCP SYNC-ACK connection setup.

There is no current override to this timeout which is a built-in timeout to the Windows TCP layer.

How come IpSuperHttpClientChannel can do it?

It lies on the same windows TCP layer

FYI: We can’t use IpSuperHttpClientChannel because we had issues with our servers running on azure cloud servers

Hi,

they have different implementation:

  • IpHttpClientChannel connects to host in main thread:


    so it should wait for 21 sec

  • IpSuperHttpClientChannel connects to host in background thread so main thread can raise exception while background thread still works:

OK, too bad, thanks

Hi,

btw, you can use Async interfaces for your service. if ping method of service didn’t respond in few seconds then server isn’t available