I create event sink server which monitor the active connection.
When I shutdown the server and there is a connected client , the server show a error ROEventRepository.Message must be assigned. I checked it is really assigned.
I Follow the SuperTCPChannelChat and put the following shutdown event code in servdermodule ondestroy event:
procedure TServerDataModule.DataModuleDestroy(Sender: TObject);
var
ev: IChatEvents_Writer;
begin
ev := (ROEventRepository as IChatEvents_Writer);
ev.Shutdown(EmptyGUID);
Sleep(2000); // allow clients to gracefully logout.
end;
The other eventsink method is correct. Just this Shutdown event client did not receive.
Hi,
In SuperTCPChannelChat we used FormCloseQuery event - this event is fired when components in Datamodule weren’t destroyed yet.
i.e. it sends notifications, and after this close main form.
In your case, some components could be destroyed, like message component, and it is a reason why ROEventRepository.Message is nil.