RTserver and RTclient Composition


Before you use RTserver and the RTclient C++ interfaces, it helps to have an understanding of the concepts involved. Figure 5 shows the RTserver and RTclient architecture.

Figure 5 RTserver and RTclient Architecture

This architecture is made up of these major concepts:

RTserver
A process that extends the features of connections to provide transparent publish-subscribe message routing among many processes.
RTclient
Any program (user-defined or SmartSockets client) that connects to RTserver and accesses its services (under this definition RTmon can be considered an RTclient).
Project
A group of RTservers and RTclients working together.
Subject
A logical address for a message; RTclient subscribes to (registers interest in) subjects; an RTclient also publishes (sends) messages to subjects.
Data Frame
A group of messages with the same timestamp (not shown in the figure).
Monitoring
Allows you to examine detailed information about your project in real time (not shown in the figure).

More detailed information can be found in the TIBCO SmartSockets User’s Guide.

The TipcSrv Class

The SmartSockets C++ class TipcSrv creates RTclient processes that connect to RTserver. TipcSrv is derived from the base class TipcConnClient.

Figure 6 TipcConn Class Inheritance Hierarchy

Because most SmartSockets C API TipcConn* calls have a corresponding TipcSrv* equivalent that only operates on the connection to RTserver, many of the member functions in TipcConn are declared virtual, and the TipcSrv class reimplements them appropriately in its derived class. The C API TipcConn* functions that do not have TipcSrv* equivalents, such as TipcConnAccept(), do not appear in TipcConn, but rather appear in derived classes of TipcConn other than TipcSrv (such as TipcConnServer).

Because any given RTclient process is allowed to have, at most, one connection to RTserver at a time, the SmartSockets C++ class library does not allow you to construct an instance of a TipcSrv object. However, sometimes you may need to cause the C API’s TipcSrvCreate() to be called from C++ using some type of mechanism. Use the static member functions on the TipcSrv class, such as TipcSrv::InstanceCreate(), to obtain the TipcSrv functionality and optionally establish a connection to an RTserver process.

You can establish a full connection to RTserver in a single step or in two steps. This example illustrates connecting to RTserver in one step:

TipcSrv& server = TipcSrv::InstanceCreate(T_IPC_SRV_CONN_FULL); 
 

The next example illustrates connecting to RTserver in two steps.

TipcSrv& server = TipcSrv::Instance(); 
if (server.CreateCbLookup(create_cb, NULL) == NULL) { 
   server.CreateCbCreate(create_cb, NULL); 
} 
status = server.Create(T_IPC_SRV_CONN_FULL); 
if (!status) { 
   // error   
} 

The advantage of calling TipcSrv::InstanceCreate() over the combination of TipcSrv::Instance() and TipcSrv::Create() is that TipcSrv::InstanceCreate() returns a handle to a TipcSrv object and creates a connection to RTserver in one step. The advantage of using the combination of TipcSrv::Instance() and TipcSrv::Create() is that TipcSrv::Instance() returns a reference to a TipcSrv object, which in turn is used to call TipcSrv member functions, such as TipcSrv::CreateCbCreate(), prior to connecting to RTserver with the TipcSrv::Create().


TIBCO SmartSockets™ cxxipc Class Library
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com