ITsSbLoadBalancing::GetMostSuitableTarget method (sbtsv.h)

This is a callback method that you implement in your app, in order to determines the most suitable target to which to direct an incoming client connection. The Remote Desktop Connection Broker (RD Connection Broker) calls your implementation when the broker needs to redirect an incoming client connection.

Syntax

HRESULT GetMostSuitableTarget(
  [in] ITsSbClientConnection        *pConnection,
  [in] ITsSbLoadBalancingNotifySink *pLBSink
);

Parameters

[in] pConnection

A pointer to an ITsSbClientConnection object. Information specific to a client connection, such as user name and farm name, can be obtained from this object.

[in] pLBSink

A pointer to an ITsSbLoadBalancingNotifySink object. If the plug-in successfully determines where to redirect the connection, it should return the load balancing result by using this sink object. For more information, see ITsSbLoadBalanceResult.

Return value

If the method succeeds, then return S_OK. Otherwise, indicate failure by returning any failure HRESULT. But if you want your plug-in to indicate that it has failed to determine a target, then you can return E_SB_LOAD_BAL_FAILED.

Remarks

The default load-balancing algorithm in RD Connection Broker redirects an incoming connection to the server with the fewest remote sessions. Your plug-in can use this method to override the default load-balancing algorithm. For example, you could define an algorithm that assigns connections to servers by comparing resource use on the target servers. You could also redirect the connection based on the information in the client connection object, such as the InitialProgram property.

Requirements

Requirement Value
Minimum supported client None supported
Minimum supported server Windows Server 2012
Target Platform Windows
Header sbtsv.h

See also

ITsSbClientConnection

ITsSbLoadBalanceResult

ITsSbLoadBalancing

ITsSbLoadBalancingNotifySink