CodeGear's SOAPHTTPTrans
implementation sets timeouts globally, not per session. Here's the relevant code from THTTPReqResp.Send
:
{ Timeouts }
if FConnectTimeout > 0 then
Check(not InternetSetOption({Request}nil, INTERNET_OPTION_CONNECT_TIMEOUT, Pointer(@FConnectTimeout), SizeOf(FConnectTimeout)));
if FSendTimeout > 0 then
Check(not InternetSetOption({Request}nil, INTERNET_OPTION_SEND_TIMEOUT, Pointer(@FSendTimeout), SizeOf(FSendTimeout)));
if FReceiveTimeout > 0 then
Check(not InternetSetOption({Request}nil, INTERNET_OPTION_RECEIVE_TIMEOUT, Pointer(@FReceiveTimeout), SizeOf(FReceiveTimeout)));
What I've had to do to is use the OnBeforePost
handler to set the timeouts:
transport.OnBeforePost := configureHttpRequest;
procedure Tsomething.configureHttpRequest(const HTTPReqResp: THTTPReqResp; Data: Pointer);
begin
InternetSetOption(Data, INTERNET_OPTION_CONNECT_TIMEOUT, Pointer(@FconnectTimeoutMS), SizeOf(FconnectTimeoutMS));
InternetSetOption(Data, INTERNET_OPTION_SEND_TIMEOUT, Pointer(@FsendTimeoutMS), SizeOf(FsendTimeoutMS));
InternetSetOption(Data, INTERNET_OPTION_RECEIVE_TIMEOUT, Pointer(@FreceiveTimeoutMS), SizeOf(FreceiveTimeoutMS));
end;
The MSDN documentation for these options is found at http://msdn.microsoft.com/en-us/library/aa385328%28VS.85%29.aspx