TROCustomDiscoveryServer

Overview

The TRODiscoveryServer class implements the server side of the local network server discovery infrastructure in the Remoting SDK.

Location


 

constructor Create  override

Standard component constructor

constructor Create(aOwner: TComponent)

Parameters:

  • aOwner: Owner

Assign  override

Copies the contents of another, similar object.

procedure Assign(Source: TPersistent)

Parameters:

  • Source: Instance whose properties will be copied

FindService  protected

This internal method is responsible for locating the service within the registered services list. Returns the service IP address.

function FindService(const iName: string; var ioDiscoveryOptions: TRODiscoveryOptions; var ioHandled: Boolean): string

Parameters:

  • iName: Service name to find
  • ioDiscoveryOptions: Class representing the discovery options, expandable to add some custom ones
  • ioHandled: Output boolean parameter to indicate if the find request was handled

Notification  protected override    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure Notification(aComponent: TComponent; Operation: TOperation)

Parameters:

  • aComponent: component
  • Operation: operation

OnServiceFound

This event is fired when a Service probed for by a client was found on the local server. The event gives the opportunity to stop the Service from being returned as available on a case by case basis. Also, any user-defined TRODiscoveryOptions descendant passed from the client is available in the event for inspection, and (possibly different) TRODiscoveryOptions can be returned to the server.

Using this event, the discovery server can take more detailed control over what Services it declares as available.

For example:

  • TRODiscoveryOptions passed by the client might define certain conditions that are expected from the Service that the server evaluates.
  • Multiple servers might be located on the local network to handle calculation tasks. The client might pass a value describing the complexity of the needed work when probing for servers, and each server could evaluate its own current CPU load when handling the OnServiceFound event to determine if it is currently able to accommodate the request. The client would only receive responses from those servers that currently are available.

The Service Discovery sample application included with the Remoting SDK illustrates this by introducing a fictitious "Server Load" value.

property OnServiceFound: TRODiscoveryServiceFoundEvent read write
delegate: procedure OnServiceFound(aSender: TObject; aName: string; var ioDiscoveryOptions: TRODiscoveryOptions; var ioHandled: Boolean)

ROFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure ROFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

RORemoveFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure RORemoveFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

SendRemoveNotification  protected    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure SendRemoveNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

ServerAddress

Specifies the IP address to present as the address for any service on the current server. If this property is empty, the default local address will be used for this purpose. Assigning a value to this property is rarely needed.

You might want to override this address to send back a host name or the address of a proxy server, instead of the local hosts address. Also, the discovery server could be acting on behalf of a different host on the network that implements the actual services, and should return that host's address.

property ServerAddress: string read write

ServiceList

The list of Services that should be made available for discovery. This is a simple string list of names that the server will react to when being probed. In addition to this list, the SupportRegisteredServerClasses property controls if all Remoting SDK service classes registered within the server will also be automatically discoverable.

property ServiceList: TStrings read write

SupportRegisteredServerClasses

Controls if all Remoting SDK Service classes registered within the server will automatically be discoverable (true) or not (false). If set to false, only the service names manually specified in the ServiceList property will be discoverable. It is of course possible to manually add a subset of registered services to the ServiceList if desired.

property SupportRegisteredServerClasses: Boolean read write

 

ServerAddress

Specifies the IP address to present as the address for any service on the current server. If this property is empty, the default local address will be used for this purpose. Assigning a value to this property is rarely needed.

You might want to override this address to send back a host name or the address of a proxy server, instead of the local hosts address. Also, the discovery server could be acting on behalf of a different host on the network that implements the actual services, and should return that host's address.

property ServerAddress: string read write

ServiceList

The list of Services that should be made available for discovery. This is a simple string list of names that the server will react to when being probed. In addition to this list, the SupportRegisteredServerClasses property controls if all Remoting SDK service classes registered within the server will also be automatically discoverable.

property ServiceList: TStrings read write

SupportRegisteredServerClasses

Controls if all Remoting SDK Service classes registered within the server will automatically be discoverable (true) or not (false). If set to false, only the service names manually specified in the ServiceList property will be discoverable. It is of course possible to manually add a subset of registered services to the ServiceList if desired.

property SupportRegisteredServerClasses: Boolean read write

 

constructor Create  override

Standard component constructor

constructor Create(aOwner: TComponent)

Parameters:

  • aOwner: Owner

Assign  override

Copies the contents of another, similar object.

procedure Assign(Source: TPersistent)

Parameters:

  • Source: Instance whose properties will be copied

FindService  protected

This internal method is responsible for locating the service within the registered services list. Returns the service IP address.

function FindService(const iName: string; var ioDiscoveryOptions: TRODiscoveryOptions; var ioHandled: Boolean): string

Parameters:

  • iName: Service name to find
  • ioDiscoveryOptions: Class representing the discovery options, expandable to add some custom ones
  • ioHandled: Output boolean parameter to indicate if the find request was handled

Notification  protected override    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure Notification(aComponent: TComponent; Operation: TOperation)

Parameters:

  • aComponent: component
  • Operation: operation

ROFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure ROFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

RORemoveFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure RORemoveFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

SendRemoveNotification  protected    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure SendRemoveNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

 

OnServiceFound

This event is fired when a Service probed for by a client was found on the local server. The event gives the opportunity to stop the Service from being returned as available on a case by case basis. Also, any user-defined TRODiscoveryOptions descendant passed from the client is available in the event for inspection, and (possibly different) TRODiscoveryOptions can be returned to the server.

Using this event, the discovery server can take more detailed control over what Services it declares as available.

For example:

  • TRODiscoveryOptions passed by the client might define certain conditions that are expected from the Service that the server evaluates.
  • Multiple servers might be located on the local network to handle calculation tasks. The client might pass a value describing the complexity of the needed work when probing for servers, and each server could evaluate its own current CPU load when handling the OnServiceFound event to determine if it is currently able to accommodate the request. The client would only receive responses from those servers that currently are available.

The Service Discovery sample application included with the Remoting SDK illustrates this by introducing a fictitious "Server Load" value.

property OnServiceFound: TRODiscoveryServiceFoundEvent read write
delegate: procedure OnServiceFound(aSender: TObject; aName: string; var ioDiscoveryOptions: TRODiscoveryOptions; var ioHandled: Boolean)