How to enable/disable server from receiving requests

I am trying to create a server which will be controlled by an administrative App.
So, this server will have two main clients: users using an ordinary application to do their business and administrators using another application just to configure the server.
The admin connection will be always open and the user connection could be - by the admin - be ready or not to receive connections.
In my mind, I figured out two message channels (TROBinMessage) in the server, one (admin) always opened and the other (user) could be open or not.
Two questions arised:

  1. Is it a good solution? Is there a better or simpler way to do that?
  2. I couldn’t figure out how to disable just one TRoBinMessage in the server in order to disable users connections.

regards

use one port for admin connection and second one - for usual.
so you can just stop “usual” port

But can I use just one port and two TROBinMessages? For instance, one with /bin path and other with /admin path?
If so, how can I disable just one binMessage?

yes, you can.

for registering/unregistering of server’s dispatcher in run-time, use code like

  TROMessageDispatcher(ROServer.Dispatchers.Add).Message := ROMessage;

and

  i:=ROServer.Dispatchers.DispatcherByName(ROMessage.Name).Index;
  if i <>-1 then
    ROServer.Dispatchers.Delete(i);

Hi EvgenyK

I am wondering what would be the effect of deleting a dispatcher while a request is been executed. Does RO finish it gracefully, eg, finish the on-going request and doesn’t accept further requests in this interface?

all currently executed requests will be finished as expected but new ones will be disallowed

Could I use the code below instead?

procedure TsrvControl.DesabilitaServidor;
var
  nomeDispatcher: string;
begin
  nomeDispatcher := 'ROMessage';
  ROServer.Dispatchers.DispatcherByName(nomeDispatcher).Enabled := false;
end;

Moreover, is there a way to control the timeout time of a remote procedure?

yes, you can disable dispatcher.
in this case, client will receive Dispatcher for "%s" is disabled. error.

you can increase timeouts on client-side if your server-side’s method takes too long time