Clientchannel switching with serverlocator (no load balance)

We have a mainserver and a “standby” server. Focus is always on the mainserver. As long the mainserver is available - the client only may communicate with that one. Even if the standby server is online. Just if the mainserver (ROService) is offline client has to connect to the standby one (if available). So far i’ve created two channels and for each service two service interfaces.

  FROMainChannel := TROSynapseSuperTCPChannel.Create(nil);
  FROMainChannel.AutoReconnect := true;
  FROMainChannel.Host := '';
  FROMainChannel.Port := 8099;
  FROMainChannel.SynchronizeEvents := true;
  FROMainChannel.OnConnected := OnMainChannelConnected;
  FROMainChannel.OnDisconnected := OnMainChannelDisconnected;
  FROMainMessage := TROBinMessage.Create;

  FROMainAppService   := CoVideoAppServiceV3.Create(FROMainMessage, FROMainChannel);
  FROMainPtzService   := CoPtzService.Create(FROMainMessage, FROMainChannel);
  FROMainMailService  := CoMailService.Create(FROMainMessage, FROMainChannel);
  FROMainSwitchService:= CoSwitchGroupMgmt.Create(FROMainMessage, FROMainChannel);
  FROMainWallService  := CoWallSwitchGroupMgmt.Create(FROMainMessage, FROMainChannel);

Same as above for the second channel. Depending on the available connections one or the other service has to be used. Would it be possible to use just one channel somehow with the serverlocator to match this requirement?


yes, it is possible.
Try to play with the channel.AutoReconnectBehavior property.

also you can use the Probe method for detecting state of main server.

Actually i’ve played already with them - but with no success.
Could you give me a small example by any chance? Or maybe modify the load balancing sample project (no code first) to show the desired behaviour.
Thanks as always for your efforts.


check sample -
Load (64.7 KB)


  • launch two servers, activate both servers
  • launch client
  • check send request each second automatically
  • requests are executed via alpha
  • disable alpha
  • requests are executed via beta
  • enable alpha
  • requests are executed via alpha again