You are not logged in.
Pages: 1
Hi,
I'm trying to use CrossPlatform client and encountered a problem when I need to define Connection Timeout.
When I do not set Connection Timeout on Android then the connection to the server off (eg. when server is down) lasts nearly seven minutes! During this time an application is not responding (is suspended). I found a place where it should be set Connection Timeout.
In unit SynCrossPlatformSpecific.pas, in procedure TIndyHttpConnectionClass.URI():
fConnection.ConnectTimeout := MY_CONNECTION_TIMEOUT_VALUE; //in this place I add my code
if Call.Verb='GET' then // allow 404 as valid Call.OutStatus
fConnection.Get(fURL+Call.Url,OutStr,[HTML_SUCCESS,HTML_NOTFOUND]) else
if Call.Verb='POST' then
fConnection.Post(fURL+Call.Url,InStr,OutStr) else
if Call.Verb='PUT' then
fConnection.Put(fURL+Call.Url,InStr) else
if Call.Verb='DELETE' then
fConnection.Delete(fURL+Call.Url) else
raise Exception.CreateFmt('Indy does not know method %s',[Call.Verb]);
This setting causes the application returns control at the specified time.
Is possible to add properties to these settings at TSQLRestClientURI? And then pass them along with other parameters by TSQLRestURIParams? Or in any other similar manner?
Another option is to provide your own implementation TAbstractHttpConnection class, by indicating the type of class in any other way than by the following function:
function HttpConnectionClass: TAbstractHttpConnectionClass;
begin
result := TMyHttpConnectionClass;
end;
Maybe it would be good to put this function in the TSQLRestClientHTTP class?
TSQLRestClientHTTP = class
[...]
public
function HttpConnectionClass: TAbstractHttpConnectionClass; virtual;
end;
Or pass it as a procedural type?
type
TAbstractHttpConnectionClassFunction = function HttpConnectionClass: TAbstractHttpConnectionClass;
TSQLRestClientHTTP = class
private
fHttpConnectionClassFunction : TAbstractHttpConnectionClassFunction;
[...]
public
property HttpConnectionClassFunction : TAbstractHttpConnectionClassFunction write fHttpConnectionClassFunction;
end;
The same applies to the Read Timeout parameter.
best regards
Jacek
Offline
Nice idea.
Should be implemented by http://synopse.info/fossil/info/fbe68455aa
Offline
Thx :-)
Offline
Pages: 1