TZeroConfHubClient Class

From RemObjects Wiki
Jump to: navigation, search

This is a Library topic for RemObjects SDK for Delphi
This page is generated from external data, please do not update

InterfacesClassesAliasesImplements

Contents

Overview

The TZeroConfHubClient implements the IROStreamWorkerCallbacks interface, which is used in the ZeroConf environment to provide callbacks from background working threads (like TROStreamWorker) to callers (such as TROZeroConfRegistrationEngine or TROZeroConfResolveEngine). It is used internally by the TROServiceSetup, TROHubRegistrationStrategy, TROHubBrowseStrategy, etc. classes to communicate with the ROZeroConf Hub.


Location

uROZeroConfHub.pas TZeroConfHubClient | Descendants

Implemented interfaces


Properties

CommandTimeout

Time in millisecond to wait for a response (90000 by default).



property CommandTimeout: integer read write


Running

True if there is a running TROStreamWorker (when Start was called and Stop is not called yet).



property Running: boolean read


Instance Methods

constructor Create

Initializes the instance and calls Start. If AutoStartHub is True, Start will call LaunchHub to activate the ROZeroConf Hub.


constructor Create(const AutoStartHub: Boolean)


Parameters:

  • AutoStartHub:


destructor Destroy   override



destructor Destroy


_AddRef   protected stdcall

Always returns -1 to indicate that no reference counting is taking place.


function _AddRef: Integer


_Release   protected stdcall

Always returns -1 to indicate that no reference counting is taking place.


function _Release: Integer


BlockResolve

Tries to resolve the service of the type aServiceType in the domain aDomain with the name aServiceName, blocking for no more than aTimeout seconds.


function BlockResolve(const aTimeout: integer; aServiceName: UnicodeString; aServiceType: UnicodeString; aDomain: UnicodeString; aIPType: integer; out aFullName: Unicodestring; out aLocalAddress: Unicodestring; out aPort: integer; out aText: TROHubBytes; out anIP4: string; out anIP6: string): boolean


Parameters:

  • aTimeout: Maximum time in seconds to wait for a response
  • aServiceName: Service name
  • aServiceType: Service type name
  • aDomain: Service domain name
  • aIPType: AF_UNSPEC, AF_INET or AF_INET6
  • aFullName: (out) compound service name
  • aLocalAddress: (out)
  • aPort: (out) TCP port number of the service
  • aText: (out) additional information
  • anIP4: (out) IP address for AF_INET
  • anIP6: (out) IP address for AF_INET6


BrowseService

Asks the ROZeroConf Hub for the registered aServiceType in the aDomain services with help of the TROStreamWorker. When a request is done, aDelegate.ResolveBrowseResult will be called along with the value of aUserData. Returns the host's handle of the discovered service.


function BrowseService(const aServiceType: UnicodeString; const aDomain: UnicodeString; const aUserData: Pointer; const aDelegate: TROZeroConfResolveBrowseResult): string


Parameters:

  • aServiceType: Service type name
  • aDomain: Service domain name
  • aUserData: Caller's context data
  • aDelegate: Callback


CloseHandle

Notifies the ROZeroConf Hub that aHandle is not used anymore.


procedure CloseHandle(aHandle: string)


Parameters:

  • aHandle: Previously acquired handle


ControlCommand   protected

Implements the IROStreamWorkerCallbacks.ControlCommand by doing nothing.


procedure ControlCommand(aSender: TROStreamWorker; aName: UnicodeString; aArguments: TKeyValuePair)


Parameters:

  • aSender:
  • aName:
  • aArguments:


CreateTCPClient   protected virtual abstract

Abstract method to obtain a transferring medium. See the TZeroConfHubSynapseClient as an example of an implementation.


function CreateTCPClient: TTCPStream


Data   protected

Implements IROStreamWorkerCallbacks.Data by decoding aData and triggering a waiting request.


procedure Data(aSender: TROStreamWorker; aData: TROHubBytes)


Parameters:

  • aSender: Ignored
  • aData: Incoming package


Disconnected   protected

Stops an internal TROStreamWorker.


procedure Disconnected(aSender: TROStreamWorker)


Parameters:

  • aSender: Ignored


GetMyHostName

Asks the ROZeroConf Hub to 'GetMyHostName'.


function GetMyHostName: UnicodeString


LaunchHub

Tries to launch the ROZeroConf Hub.


function LaunchHub: Boolean


QueryInterface   protected virtual stdcall

Delegates a call to TObject.GetInterface.


function QueryInterface(const IID: TGUID; out Obj: ): HResult


Parameters:

  • IID:
  • Obj:


RegisterService

Sends a ROZeroConf Hub request to register the service with the provided parameters. When a request is done, aDelegate.RegistrationResult will be called along with the value of aUserData. Returns the host's handle of the discovered service.


function RegisterService(const aName: UnicodeString; const aService: UnicodeString; const aDomain: UnicodeString; const aFlags: integer; const aHost: Unicodestring; const aPort: integer; const aText: TROHubBytes; const aUserData: Pointer; const aDelegate: TROZeroConfRegistrationResult): string


Parameters:

  • aName: Service name
  • aService: Service type name
  • aDomain: Service domain name
  • aFlags:
  • aHost: Host's IP
  • aPort: Host's port for the given service
  • aText: Additional information
  • aUserData: Caller's context data
  • aDelegate: Callback


ResolveAddress

Asks the ROZeroConf Hub for resolve an address of aFullName. When the request is done, aDelegate.ResolveAddressResult will be called along with the value of aUserData. Returns the host's handle of the discovered service.


function ResolveAddress(const aFullName: UnicodeString; const aUserData: Pointer; const aDelegate: TROZeroConfResolveAddressResult): string


Parameters:


ResolveService

Asks the ROZeroConf Hub to resolve aServiceName with aServiceType in aDomain. When the request is done, aDelegate.ResolveServiceResult will be called along with the value of aUserData. Returns the host's handle of the discovered service.


function ResolveService(const aServiceName: UnicodeString; const aServiceType: UnicodeString; const aDomain: UnicodeString; const aUserData: Pointer; const aDelegate: TROZeroConfResolveServiceResult): string


Parameters:

  • aServiceName: Service name.
  • aServiceType: Service type name
  • aDomain: Service domain name
  • aUserData: Caller's context data
  • aDelegate: Callback


Start

Creates a TROStreamWorker class with a stream provided by the CreateTCPClient, connects the stream with a ROZeroConf Hub and an activated worker.


procedure Start


Stop

Requests the ROZeroConf Hub to close all obtained handles and deactivate the internal worker.


procedure Stop


Descendants


See Also


Product: RemObjects SDK
Available Editions: RemObjects SDK for .NET, Xcode, Delphi, Java and JavaScript

GlossaryArticlesLibrarySamples

Personal tools
Namespaces

Variants
Actions
Navigation
products
platforms
special
Toolbox