Joining a caucus

A client joins a caucus by instantiating TStandardCaucusMember.

A caucus does not exist until the first member joins the caucus, when the TStandardCaucusMember constructor starts a caucus that runs on the host you specify with the service reference parameter. It might take a little longer for the first member to join a caucus than for subsequent members to join.

In addition to locating the proper caucus and adding the member to the caucus, the TStandardCaucusMember constructor also automatically issues a zero-byte join message to all caucus members (including the originator).

To join a caucus:

  1. Instantiate a service reference to the caucus you want to join.
  2. Construct a TStandardCaucusMember object using the service reference.
The example creates a TNetworkServiceReference object and passes this into a TStandardCaucusMember object. The TStandardCaucusMember constructor takes a TServiceReference object. TServiceReference is an abstract base class; this example creates an instance of TNetworkServiceReference (a class that derives from TServiceReference) and uses it to construct a TStandardCaucusMember object.

In this example, caucusText is the name of the caucus the client is joining, and hostText is the name of the host machine on which the caucus runs. For more information about constructing service reference objects, refer to the "Communications access" chapter of OS Services.

    TNetworkServiceReference reference 
        ( TLocalObjectName (TStandardCaucusMember::kCaucusObjectType, caucusText ), 
        TaligentIPNetworkName ( TDNSHostName ( hostText ) ) ) ;
    TStandardCaucusMember fCaucusMember ( reference ) ;
NOTE Each member of a caucus should use the a compatible derived class of TCaucusMember. For example, if you are using the standard caucus implementation, implement all caucus members using TStandardCaucusMember, not another class derived from TCaucusMember. If you mix caucus members of different types, you risk unpredictable results when members try to send and receive messages.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker