You are not logged in.
The default connection timeout for HttpGet appears to be 30 seconds.
How can I change this number? I'd like to make it smaller.
Thanks!
Offline
Did you mean HttpGet(), then take a look at WGet().
Default timeout is here "HTTP_DEFAULT_RECEIVETIMEOUT: integer = 30000", but you can overwrite it.
With best regards
Thomas
Offline
@tbo Thank you for the heads up.
I am looking at mormot.net.client.HttpGet function, which does not provide a parameter for setting connection time out. Internally, HttpGet ->OpenHttpGet->OpenHttp->TCrtSocket.Open->THttpClientSocket.Create(0)
I understand I can change HTTP_DEFAULT_RECEIVETIMEOUT to a different value, but I really don't want to change that default value.
Is it an intentional design that mormot.net.client.HttpGet does not allow setting a non-default timeout? @ab Do you think it make sense to add an extra timeout parameter, so we can use a non-default value?
Last edited by wxinix (2022-01-09 23:56:07)
Offline
I haven't had any reason to change it yet, so I could be wrong.
In the Unit mormot.net.client I read the following:
/// THttpRequest timeout default value for data receiving
// - default is 30 seconds
// - used e.g. by THttpClientSocket, THttpRequest, TRestHttpClientRequest and
// TRestHttpClientGeneric
// - you can override this value by setting the corresponding parameter in
// the class constructor
HTTP_DEFAULT_RECEIVETIMEOUT: integer = 30000;
The last sentence of the help can be implemented like this.
Maybe it will help with your problem.
With best regards
Thomas
Offline
@tbo hi Thomas, thank you again.
I ended up using THttpClientSocket class directly, instead of the function HttpGet.
THttpClientSocket has a constructor that allows specifying a non-default time out.
Offline