Hi
I’ve changed the order of freeing components and, indeed, when I free InMemorySessionManager first (before ThttpServer) it worked and I don’t need to clearSessions manually.
It worked too to change events and use formCloseQuery when I start the server manually in order to let clients know that the server is down and close gracefully.
The only problem is when starting server as a Windows Service.
I use this code in project file to do that:
sServiceName := ExtractFileName(Application.ExeName);
sServiceName := StringReplace(sServiceName, ExtractFileExt(sServiceName), '', [rfReplaceAll]);
if ROStartService(sServiceName, sServiceName, 'Server Name') then begin
ROService.CreateForm(TdtmService,dtmService);
ROService.Run;
exit;
end;
Is there a safe event there where I can hook the code to send something to client in order to let him know that the server is down?