You are not logged in.
My FireMonkey Android Client takes 2 minutes to timeout when the Server is not running.
I get the message "Impossible to connect to ... server'.
Is there a way to reduce that time to, say 15 seconds?
The Android Client calls:-
mORMotClient.GetClient
That function is defined in the unit mORMotClient as :-
function GetClient(const aServerAddress, aUserName,aPassword: string;
aServerPort: integer; const aServerRoot: string; aHttps: boolean): TSQLRestClientHTTP;
begin
result := TSQLRestClientHTTP.Create(aServerAddress,aServerPort,
GetModel(aServerRoot),true,aHttps); // aOwnModel=true
try
if (not result.Connect) or (result.ServerTimeStamp=0) then
raise ERestException.CreateFmt('Impossible to connect to %s:%d server',
[aServerAddress,aServerPort]);
if not result.SetUser(TSQLRestServerAuthenticationDefault,aUserName,aPassword) then
raise ERestException.CreateFmt('%s:%d server rejected "%s" credentials',
[aServerAddress,aServerPort,aUserName]);
except
result.Free;
raise;
end;
end;
I changed the function TSQLRestClientHTTP.Create in unit SynCrossPlatformREST to :-
constructor TSQLRestClientHTTP.Create(const aServer: string;
aPort: integer; aModel: TSQLModel; aOwnModel, aHttps: boolean
{$ifndef ISSMS}; const aProxyName, aProxyByPass: string;
aSendTimeout, aReceiveTimeout, aConnectionTimeOut: Cardinal{$endif});
begin
inherited Create(aModel,aOwnModel);
fParameters.Server := aServer;
fParameters.Port := aPort;
fParameters.Https := aHttps;
{$ifndef ISSMS}
fParameters.ProxyName := aProxyName;
fParameters.ProxyByPass := aProxyByPass;
{fParameters.ConnectionTimeOut := aConnectionTimeOut;}
fParameters.ConnectionTimeOut := 15000; {15sec} <===
{fParameters.SendTimeout := aSendTimeout;}
fParameters.SendTimeout := 15000; {15sec} <===
{fParameters.ReceiveTimeout := aReceiveTimeout;}
fParameters.ReceiveTimeout := 15000; {15sec} <===
{$endif}
fKeepAlive := 20000;
end;
However this didn't affect the timeout.
Is there some other way to achieve this?
Offline
AFAIR the default values are 30 seconds.
constructor Create(const aServer: string; aPort: integer; aModel: TSQLModel;
aOwnModel: boolean=false; aHttps: boolean=false
{$ifndef ISSMS}; const aProxyName: string='';
const aProxyByPass: string=''; aSendTimeout: Cardinal=30000;
aReceiveTimeout: Cardinal=30000; aConnectionTimeOut: cardinal=30000{$endif});
reintroduce; virtual;
Do not touch the SynCrossPlatformREST unit!
But you can modify the generated mORMotClient.pas to customize the TSQLRestClientHTTP.Create() parameters as you expect.
Sounds like if the Indy library do not have the timeout parameters set.
Please check http://synopse.info/fossil/info/3101187c6f
Offline
mORmot Framework Client Support FireMonkey Android Client?
How do I fail to compile,
As shown below:
[DCC Fatal Error] SynCommons.pas(773): F2613 Unit 'Contnrs' not found.
Offline
Wangming: On a FireMonkey Android client you should not reference 'SynCommons.pas'.
You should reference the CrossPlatform units.
Offline
Offline