rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWBufferedSendPortal Class Reference
[Essential Networking Module]

Provides buffering of send() calls only, possibly improving performance by limiting calls to the underlying RWPortal. More...

#include <rw/network/RWBufferedSendPortal.h>

Inheritance diagram for RWBufferedSendPortal:
RWPortal

List of all members.

Public Member Functions

 RWBufferedSendPortal (void)
 RWBufferedSendPortal (const RWPortal &portal, size_t bufferSize)
void flush (unsigned long timeout=0)

Detailed Description

RWBufferedSendPortal inherits from RWPortal to provide buffering of send() calls. In cases where calling send() on the underlying RWPortal is expensive, RWBufferedSendPortal may substantially increase efficiency by limiting the number of calls to the underlying RWPortal.

Note:
When buffering send data, requests to send data should be made through the RWBufferedSendPortal object. If you must make calls directly to the underlying RWPortal, be sure to call flush() first. Failure to do so may result in data being transmitted out of order.

Buffered data in the RWBufferedSendPortal is sent through the underlying RWPortal when any of the following three conditions are met:

Examples

 RWPortal portal = RWSocketPortal();
 portal = RWBufferedSendPortal(portal, 1024);

Constructor & Destructor Documentation

RWBufferedSendPortal::RWBufferedSendPortal ( void   ) 

Constructs an invalid RWBufferedSendPortal. Attempts to send or receive on the portal throw an RWNetNoChannelError exception.

To use an instance created with this constructor, you must assign to it from a valid RWBufferedSendPortal instance.

RWBufferedSendPortal::RWBufferedSendPortal ( const RWPortal portal,
size_t  bufferSize 
)

Constructs a buffered portal on an existing portal. bufferSize is the requested size for the underlying buffer.


Member Function Documentation

void RWBufferedSendPortal::flush ( unsigned long  timeout = 0  ) 

Sends any data in the send buffer immediately. This function does not affect data in the recv buffer, or a portal that is not buffering send data.

The parameter timeout specifies the maximum amount of time in milliseconds to wait for any single blocking send() call. There may be multiple such calls made in a single call to flush(). If a timeout is not specified, or is 0, this method blocks indefinitely.

This function throws a RWNetCantSendError exception if the send() call on the underlying portal returns an error or fails to send any data.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.