Establishing a communications channel

The Message Streams classes provide the protocol for establishing a communications channel between threads. Using these classes, you create objects that communicate using the standard streaming model. You stream data into an object at one end of the channel and stream data out of an object at the other end.

Message Streams handle the details of inter-process communication for you, whether you are communicating between two threads on the same system or threads located on different hosts that are connected over a network.

NOTE For this release, Message Streams can only establish networked communications channels between machines that run the CommonPoint application system.


The message streams communication model

Message Streams communication uses a synchronous send-receive-reply model called the request-reply interface. In a request-reply exchange:

  1. The client sends a request to the server.
  2. The server receives the client request and processes it.
  3. The server formulates a reply and sends it back to the client.
  4. The client receives the reply.

In the request-reply interface, a server can handle requests from multiple clients. The request and reply are bound to a thread for the duration of the transaction.

NOTE Datastreams, a Message Streams interface supporting full duplex communications, is not available in this release.

Implementing request-reply communication

You implement request-reply communication using objects of classes TRequestSenderStream and TRequestReceiverStream. These classes derive from TStream, and so they include basic streaming protocol.


When a server starts up, it instantiates a TRequestReceiverStream. The constructor for this class requires a service definition object as a parameter. The service definition is necessary because it establishes the service access point through which the server receives client messages and sends replies. Once you create the first request receiver stream, the service definition is considered active.


A client that wants to connect to a server first must identify the service it needs by creating a valid service reference and then instantiating a TRequestSenderStream. Similar to TRequestReceiverStream, you construct a TRequestSenderStream using the service reference. The client can then stream data into the request sender stream and send a message to the server.



[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