SourcePro® 2022.1 |
SourcePro® API Reference Guide |
Provides buffering of send() calls only, possibly improving performance by limiting calls to the underlying RWPortal. More...
#include <rw/network/RWBufferedSendPortal.h>
Public Member Functions | |
RWBufferedSendPortal (void) | |
RWBufferedSendPortal (const RWPortal &portal, size_t bufferSize) | |
void | flush (unsigned long timeout=0) |
Public Member Functions inherited from RWPortal | |
RWPortal () | |
RWPortal (const RWPortal &x) | |
~RWPortal () | |
RWPortal & | operator= (const RWPortal &x) |
RWNetBuf | recv () const |
int | recv (char *buf, int bufLen, RWNetBuf::State *state=0) const |
RWNetBuf | recvAtLeast (int n) const |
int | recvAtLeast (char *buf, int bufLen, int n, RWNetBuf::State *state=0) const |
int | send (const RWCString &s) const |
int | send (const char *buf, int buflen) const |
int | sendAtLeast (const char *buf, int bufLen, int n) const |
void | sendAtLeast (const char *buf, int bufLen) const |
int | sendAtLeast (const RWCString &s, int n) const |
void | sendAtLeast (const RWCString &s) const |
Additional Inherited Members | |
Protected Member Functions inherited from RWPortal | |
RWPortal (RWPortalImp *impl) | |
const RWPortalImp * | implementation () const |
RWPortalImp * | implementation () |
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.
Buffered data in the RWBufferedSendPortal is sent through the underlying RWPortal when any of the following three conditions are met:
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.
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.
Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |