Sending messages within a caucus

Caucus members send messages using TStandardCaucusSendMessage. In this standard caucus implementation, sending is based on individual messages, rather than on a data stream. Clients decide what message size to use.

The standard caucus implementation recognizes five types of messages--join, leave, pause, resume, and data messages. TCaucusSendMessage is used only to generate data messages--the framework generates the other message types either automatically or as part of other messages.

Messages within a caucus are issued one at a time, rather than as a continuous data stream. When a caucus member sends a message, all caucus members receive the message, including the originator.

The Caucus framework guarantees that all members receive messages in the same order. It does not, however, guarantee what that order is. If, for example, two members send a message at approximately the same time, you might not be able to predict which message is distributed first. You can be sure, however, that all caucus members receive the messages in the identical order.

To send a message:

  1. Construct a TStandardCaucusSendMessage object on the stack using an alias to the sending caucus member.
  2. Stream data into the TStandardCaucusSendMessage object.
  3. Destroy the object.
This example sends a message. The message object is destroyed when object leaves scope. The framework sends the message to the caucus once the TStandardCaucusSendMessage object is destroyed.

      {
          TStandardCaucusSendMessage message ( fCaucusMember ) ;
          data >>=message;
      }
There is no limit to the size of a caucus message. Zero-byte messages are allowed.


[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