Class: TRequestReceiverStream

Declaration: RequestReply.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TMessageStream, MWaitable

Inherited By:

None.

Purpose:

TRequestReceiverStream is the class that a server uses to receive requests from, and send replies to, a client.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Classes may be derived from TRequestReceiverStream to define a specific type of protocol for communication. Currently (none). None of the member functions have to be overridden. Derived classes may override Abort to do something more interesting (see Abort). Derived classes may override HandleOpen to add more operation for stream initialization. When overriding HandleOpen, the parent class HandleOpen must be called first.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: TRequestReceiverStream::TRequestReceiverStream

  1. TRequestReceiverStream (TServiceDefinition * serviceDefinition)
  2. TRequestReceiverStream (const TRequestReceiverStream & clone)
  3. TRequestReceiverStream ()

Interface Category:

API.

Purpose:

  1. 1.Creates a TRequestReceiverStream that receives requests for the specified service.
  2. Copy constructor.
  3. Protected, default constructor.

Calling Context:

  1. Called by a server to create a stream to receive requests for specified service.
  2. Called to copy an object.
  3. Called by the stream-in operators.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::~TRequestReceiverStream

virtual ~ TRequestReceiverStream ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::operator=

TRequestReceiverStream & operator =(const TRequestReceiverStream & clone)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object. Call this function directly.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::Hash

virtual long Hash () const

Interface Category:

API.

Purpose:

Returns a hash value for this object.

Calling Context:

Called to return a hash value for this object. Call this Function directly.

Parameters:

Return Value:

A hash value for this object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::Receive

virtual void Receive ()

Interface Category:

API.

Purpose:

To receive the data from the underlying communications channel.

Calling Context:

Called to receive a message from a client. Call this Function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::SkipRemainingRequest

void SkipRemainingRequest ()

Interface Category:

API.

Purpose:

Discards the unread portion of a request message.

Calling Context:

Called when the server has read part of a request message and wishes to discard the remaining data. Call this Function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::FlushRequest

virtual void FlushRequest ()

Interface Category:

API.

Purpose:

Discards the unread portion of a request message.

Calling Context:

Called to ignore the remainder of the current message. Call this Function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::Reply

virtual void Reply ()

Interface Category:

API.

Purpose:

Send the buffered data to the underlying communications channel.

Calling Context:

Called when the server has finished streaming out all the reply data and wishes to send the data to the client. Call this Function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::Abort

virtual void Abort ()

Interface Category:

API.

Purpose:

If no request has been received yet, the stream state is set to initial state. At any other state an end of message and abort will be sent to the peer message stream, which causes that stream to call its member function HandleAbort. In all cases the stream state is set to its initial state.

Calling Context:

Called to abort the current transaction and puts this stream in a state that allows a new request to be received. Call this Function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::HandleOpen

virtual void HandleOpen ()

Interface Category:

API.

Purpose:

A protected member function which causes the desired effects of the member function Open (see MessageStream.d), and throws an exception if the open operation fails.

Calling Context:

Called to open the stream. This function will be called as a result of a call to Open.

Parameters:

Return Value:

None.

Exceptions:

Throws kSetupFailure if the open operation fails.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::AllocateForWrite

virtual void AllocateForWrite (StreamPosition desiredByteCount)

Interface Category:

API.

Purpose:

To allocate desired number of bytes in the buffer to the user.

Calling Context:

Called to empty the buffer so that it can be used to hold new data. This member functions is called by Streaming out(>>=) or Write function.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::AllocateForRead

virtual void AllocateForRead (StreamPosition desiredByteCount)

Interface Category:

API.

Purpose:

Receives more data into the buffer so that more data can be read from the buffer.

Calling Context:

Called to fill an empty buffer so that more data can be read from it. This member function is called by streaming in (<<=) or Read function.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::HandleWriteBufferFull

virtual void HandleWriteBufferFull (const void * data, size_t dataLength)

Interface Category:

API.

Purpose:

Sends all the data in the buffer when the buffer becomes filled, then attempts to write new data into the buffer.

Calling Context:

Called to empty the buffer so that it can be used to hold new data. This member function is called by Streaming out (>>=) or Write.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::HandleAbort

virtual void HandleAbort ()

Interface Category:

API.

Purpose:

A protected member function that handles the receipt of an abort operation from the peer message stream.

Calling Context:

Called when the peer TRequestSenderStream member function Abort is called. It is called internally when Abort is called on the other side of the connection.

Parameters:

Return Value:

None.

Exceptions:

Throws TRequestReplyException(kAbortedByOtherSide) to indicate the transaction has been aborted by the peer message stream.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRequestReceiverStream::DoRequestProtocol

virtual void DoRequestProtocol ()

Interface Category:

API.

Purpose:

Allows derived classes defining their own protocol to strip their protocol header at the beginning of a reply message. This member function is called once, before any higher level data is streamed in.

Calling Context:

Called to strip the derived class' protocol header from the beginning of a request message.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Derived classes which add their own protocol should override this member function. The overriding member function should begin its processing by calling the DoRequestProtocol member function of the base class so that the base class' header is processed first.

Member Function: TRequestReceiverStream::DoReplyProtocol

virtual void DoReplyProtocol ()

Interface Category:

API.

Purpose:

Allows derived classes defining their own protocol to add their protocol header to a reply. This member function is called once for each reply message, before higher level data is streamed out.

Calling Context:

Called to insert the derived class' protocol header at the beginning of a reply message.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Derived classes which add their own protocol should override this member function. The overriding member function should begin its processing by calling the DoReplyProtocol member function of the base class so that the base class' header is processed first.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.