#1 2014-11-19 16:35:45

alexdmatveev
Member
Registered: 2014-09-12
Posts: 87

how to set client connection timeout?

Hello gurus,

I have a client:

  FClient := TSQLHttpClientWinHTTP.Create(FServer, FPort, Model);

How to increase timeout for the client?

I tried to make so:

FClient.WinApi.ConnectionTimeout := 120000;

as it discussed here: http://synopse.info/forum/viewtopic.php?id=1335

but it looks like WinApi has no ConnectionTimeout property.

What should I do?

Thanks a lot.

Offline

#2 2014-11-20 08:18:06

alexdmatveev
Member
Registered: 2014-09-12
Posts: 87

Re: how to set client connection timeout?

I see in SynCrtSock next code:

  /// TWinHttpAPI timeout default value for DNS resolution
  // - leaving to 0 will let system default value be used
  HTTP_DEFAULT_RESOLVETIMEOUT = 0;
  /// TWinHttpAPI timeout default value for remote connection
  // - default is 60 seconds
  HTTP_DEFAULT_CONNECTTIMEOUT = 60000;
  /// TWinHttpAPI timeout default value for data sending
  // - default is 30 seconds
  // - you can override this value by setting the corresponding parameter in
  // TWinHttpAPI.Create() constructor
  HTTP_DEFAULT_SENDTIMEOUT = 30000;
  /// TWinHttpAPI timeout default value for data receiving
  // - default is 30 seconds
  // - you can override this value by setting the corresponding parameter in
  // TWinHttpAPI.Create() constructor
  HTTP_DEFAULT_RECEIVETIMEOUT = 30000;

So please show me the way to create my own TWinHttpAPI object for my FClient.

My extreme way is to change mORMot contants but I think it is not very good idea.

Thanks.

Offline

#3 2014-11-20 12:04:51

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,542
Website

Re: how to set client connection timeout?

From my experiments HTTP_DEFAULT_CONNECTTIMEOUT dose not do anything on the WinHttpAPI level. I pass small value there as described in API but nothing is changed

Offline

#4 2014-11-20 14:10:28

alexdmatveev
Member
Registered: 2014-09-12
Posts: 87

Re: how to set client connection timeout?

Thanks a lot for your time.
hmmm... so what is the solution?

Last edited by alexdmatveev (2014-11-20 14:15:46)

Offline

#5 2014-11-20 15:18:34

alexdmatveev
Member
Registered: 2014-09-12
Posts: 87

Re: how to set client connection timeout?

I have increased every timeout constant to extremely big 600000 (10 min).
and now I can send big files. Works for me so.
But I hope to get from Synopse team good solution for the task.

Thanks a lot.

Offline

#6 2014-11-20 17:40:18

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,542
Website

Re: how to set client connection timeout?

This happens because you increase HTTP_DEFAULT_SENDTIMEOUT for client side and HTTP_DEFAULT_RECEIVETIMEOUT for server side. This parameters is work OK. And you can increase it's also in TWinHttpAPI.Create(). No need to change consts.

Offline

#7 2014-11-20 20:40:18

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,231
Website

Re: how to set client connection timeout?

Yes AFAIR you have to increase the parameters on both sides.
Thanks mpv for the input.

Offline

#8 2014-11-21 07:31:32

alexdmatveev
Member
Registered: 2014-09-12
Posts: 87

Re: how to set client connection timeout?

ok, thanks
the main question for me now is how to make it from my code but not in SynCrtSock.pas ?

what should I write before or after the line below?

 FClient := TSQLHttpClientWinHTTP.Create(FServer, FPort, Model);

Offline

#9 2014-11-21 10:46:56

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,231
Website

Re: how to set client connection timeout?

Can anyone please create a ticket?

Offline

#10 2015-07-20 19:41:48

mmbk
Member
Registered: 2015-07-06
Posts: 9

Re: how to set client connection timeout?

Hi, I'm have the same problem with this code:

  winHTTP := TWinHTTP.Create('localhost', '888', false, '', '', 60000, 70000, 130000);
  try
      Result := winHTTP.Post(StringToUTF8(link), StringToUTF8(data));
  finally
    winHTTP.Free;
  end;

I think TWinHTTP.Create don't store any timeout parameters

The "winHTTP.Post" method call "THttpRequest.InternalREST" that call "self.Create(Server,Port,Https,'','')" using the default timeout parameters.

Can any one help me on this?

Thank you (sorry my english)
"

Offline

Board footer

Powered by FluxBB