You are not logged in.
Pages: 1
When I try to create a instance of HttpClient, if server is offline a exception is raised.
I don't know what is the best approach to wait/retry. Should I recreate the httpclient instance?
Offline
Thanks. But, there are some another way in the framework to check if the server is online?
Offline
Sorry for ressurect a old topic.
ServerTimeStampSynchronize() not existed when I asked the question a year ago. This is the best approach now, right?
Offline
Indeed.
If you search for ServerTimeStampSynchronize() in the documentation, you will find out a good sample:
From the client point of view, it will be consumed as such:
procedure TMainForm.FormShow(Sender: TObject);
(...)
fModel := TSQLModel.Create([],ROOT_NAME);
fClient := TSQLHttpClient.Create('localhost','888',fModel);
if not fClient.ServerTimeStampSynchronize then begin
ShowLastClientError(fClient,'Please run Project16ServerHttp.exe');
Close;
exit;
end;
if (not fClient.SetUser('User','synopse')) or
(not fClient.ServiceRegisterClientDriven(TypeInfo(IRemoteSQL),fService)) then begin
ShowLastClientError(fClient,'Remote service not available on server');
Close;
exit;
end;
end;
Our IRemoteSQL service will be accessed in sicClientDriven mode, so here we need to initialize RESTful authentication - see 18 - with a proper call to SetUser().
Note the use of ShowLastClientError() function of mORMotUILogin unit, which is able to use our SynTaskDialog unit to report standard and detailed information about the latest error.
Offline
Pages: 1