We use a TROIndyHTTPChannel and sets the following timeout properties.
FRemObjectsTransportChannel.IndyClient.ConnectTimeout := 5000;
FRemObjectsTransportChannel.IndyClient.ReadTimeout := 60000;
When we then call a function in the interface we can get a EIdReadTimeout after 5-7s.
On the server side we can see that it is actually connected within 5s and is processing the function call.
The process can take more than 5 seconds but since the read timeout is set to 60s it should not be a problem.
Is there any other way to control connect/read timeout or do I just misunderstand how it is supposed to work.
When we call the Login the ReadTimeout changes.
Login is a function in our RemObjects interface so we don’t do anything ourselves in that function but the ReadTimeout changes for some reason.
Does anyone have an idea about what could be the cause?
I can’t reproduce your situation with latest DA release. I set values for ReadTimeout:=60000 and ConnectTimeout:=5000 as you point and call service method, that contain sleep(20000); inside it. Everything works as expected.
What DA/RO and Delphi version do you use?
You could send us simple testcase reproducing situation.
To clarify my previous post, it’s when I call FRemObjectsServer.GetServerTime as ReadTimeout changes to the value of ConnectTimeout. The code for GetServerTime is the RemObjects auto-generated code for the interface.
Unfortunately, not RO code causes this situation, but Indy.
During the request processing Indy calls InternalReadLn function from IdHTTP.pas :
function TIdCustomHTTP.InternalReadLn: String;
begin
IOHandler.ReadTimeout := ConnectTimeout; //// !!!
Result := IOHandler.ReadLn;
if IOHandler.ReadLnTimedout then begin
raise EIdReadTimeout.Create(RSReadTimeout);
end;
end;
That is why ReadTimeout gets equal to ConnectTimeout.
I was tested this situation in Delphi XE2 first and coulnd’t reproduce it. Because DelphiXE2 has such implementation in IdHTTP.pas:
function TIdCustomHTTP.InternalReadLn: String;
begin
Result := IOHandler.ReadLn;
if IOHandler.ReadLnTimedout then begin
raise EIdReadTimeout.Create(RSReadTimeout);
end;
end;
So you could increase ConnectTimeout to necessary ReadTimeout value
Hi,
We solved it by putting IdHTTP.pas in the search path. Did the fix in that unit. That means we don’t have to recompile the packages. We can also upgrade RO without having to recompile RemObjects_Indy_D15 again.