Delphi SOAP Client can not keep more than 2 concurrent requests. How to increase?

杀马特。学长 韩版系。学妹 提交于 2019-12-04 04:36:59

Delphi uses Wininet.dll to make its SOAP requests, IE uses the same DLL. This limitation is in fact documented.

You have 2 choices:

  • adapt the registry like stated in the KB article
  • Use InternetSetOption before the SOAP call:

small code sample (please note that it does not include error checking):

Const 
  INTERNET_OPTION_MAX_CONNS_PER_SERVER = 73; 
  INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER = 74; 
var 
  MaxConnections : Integer;

begin 
  MaxConnections := 10; // adapt to your needs
  InternetSetOption(Nil, INTERNET_OPTION_MAX_CONNS_PER_SERVER, @MaxConnections , SizeOf(MaxConnections )); 
  InternetSetOption(Nil, INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER, @MaxConnections , SizeOf(MaxConnections )); 
 // do SOAP call
end;

By default, Delphi SOAP programs uses WinInet in Windows, and Indy (TIdHTTP) in other platforms (see USE_INDY directive in SOAPHTTPTrans.pas unit), to comunicate with the server. [1]

You can try using Indy on Windows by defining USE_INDY and recompile the SOAP library (however I have not done this myself so the detailed steps to do this are unknown to me).

p.s. the linked article also indicates that UseNagle should be set to False.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!