SourcePro® 2024.1 |
SourcePro® API Reference Guide |
An access point to a reliable byte stream communication channel. More...
#include <rw/network/RWPortal.h>
Public Member Functions | |
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 |
int | recvAtLeast (char *buf, int bufLen, int n, RWNetBuf::State *state=0) const |
RWNetBuf | recvAtLeast (int n) const |
int | send (const char *buf, int buflen) const |
int | send (const RWCString &s) const |
void | sendAtLeast (const char *buf, int bufLen) const |
int | sendAtLeast (const char *buf, int bufLen, int n) const |
void | sendAtLeast (const RWCString &s) const |
int | sendAtLeast (const RWCString &s, int n) const |
Protected Member Functions | |
RWPortal (RWPortalImp *impl) | |
RWPortalImp * | implementation () |
const RWPortalImp * | implementation () const |
Friends | |
bool | operator== (const RWPortal &p, const RWPortal &q) |
RWPortal is an access point to a reliable byte stream communication channel. It is possible for more than one RWPortal to access the same communications channel. This happens, for example, when using the copy constructor and assignment operator. Unless explicitly constructed otherwise, portal classes are designed so that when the last portal into a channel disappears, the communications channel is closed.
RWPortal is a lightweight object. In addition, the copy constructor and the assignment operator copy only the RWPortal and not the underlying communications channel, which means that those operations are inexpensive. As a result, RWPortals can be returned by value from functions and used as member data in objects.
RWPortal is implemented using the interface/implementation design pattern as described in the Essential Networking Module User's Guide. The RWPortal itself is really a handle to an implementation that represents the communication channel.
|
inline |
Creates a portal that cannot send or receive. Trying to send or receive throws an RWNetNoChannelError exception.
|
inline |
Copy constructor.
|
inline |
Destroys this portal. If other portals were created from this one by assignment or copying, they are unaffected.
|
inlineprotected |
Specifies the portal implementation. This constructor is used by derived classes that create specific types of portals by passing in specific types of portal implementations. The argument, like all RWPortalImp instances, must live on the heap.
|
inlineprotected |
Provides derived classes access to the underlying implementation.
|
inlineprotected |
Provides derived classes access to the underlying implementation.
Assignment operator. Makes self a portal to the same channel as x. Disconnects from the current channel, if any.
|
inline |
Receives a buffer of data. The version returning an int
returns the number of characters actually received. recv() makes only one call to the communications channel.
int RWPortal::recv | ( | char * | buf, |
int | bufLen, | ||
RWNetBuf::State * | state = 0 ) const |
Receives a buffer of data. The version returning an int
returns the number of characters actually received. recv() makes only one call to the communications channel.
int RWPortal::recvAtLeast | ( | char * | buf, |
int | bufLen, | ||
int | n, | ||
RWNetBuf::State * | state = 0 ) const |
Receives at least n characters into the buffer. The second version returns the number of bytes actually received. The implementation loops over recv() until either all the data is received or, for some reason, no data is returned. If no data is returned by recv(), an RWNetCantRecvError exception is thrown. If you call recvAtLeast() on a non-blocking channel, it will probably throw this same exception.
RWNetBuf RWPortal::recvAtLeast | ( | int | n | ) | const |
Receives at least n characters into the buffer. The second version returns the number of bytes actually received. The implementation loops over recv() until either all the data is received or, for some reason, no data is returned. If no data is returned by recv(), an RWNetCantRecvError exception is thrown. If you call recvAtLeast() on a non-blocking channel, it will probably throw this same exception.
|
inline |
Sends a buffer of data. Returns the number of bytes actually sent. send() makes only one call to the communications channel.
|
inline |
Sends a buffer of data. Returns the number of bytes actually sent. send() makes only one call to the communications channel.
|
inline |
Sends at least n characters into the communications channel. If n is omitted, all data is sent where appropriate, and the number of bytes actually sent is returned. The implementation loops over send() to send the data. If any of the calls to send() cannot send any data, an RWNetCantSendError exception is thrown. If sendAtLeast() is called on a non-blocking channel, it will probably throw this same exception.
int RWPortal::sendAtLeast | ( | const char * | buf, |
int | bufLen, | ||
int | n ) const |
Sends at least n characters into the communications channel. If n is omitted, all data is sent where appropriate, and the number of bytes actually sent is returned. The implementation loops over send() to send the data. If any of the calls to send() cannot send any data, an RWNetCantSendError exception is thrown. If sendAtLeast() is called on a non-blocking channel, it will probably throw this same exception.
void RWPortal::sendAtLeast | ( | const RWCString & | s | ) | const |
Sends at least n characters into the communications channel. If n is omitted, all data is sent where appropriate, and the number of bytes actually sent is returned. The implementation loops over send() to send the data. If any of the calls to send() cannot send any data, an RWNetCantSendError exception is thrown. If sendAtLeast() is called on a non-blocking channel, it will probably throw this same exception.
|
inline |
Sends at least n characters into the communications channel. If n is omitted, all data is sent where appropriate, and the number of bytes actually sent is returned. The implementation loops over send() to send the data. If any of the calls to send() cannot send any data, an RWNetCantSendError exception is thrown. If sendAtLeast() is called on a non-blocking channel, it will probably throw this same exception.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |