Main Page   Modules   Namespace List   Class Hierarchy   Compound List   Namespace Members   Compound Members   Related Pages  

GNE::SocketPair Class Reference
[Internal Classes]

#include <SocketPair.h>

List of all members.

Public Member Functions

 SocketPair (NLsocket reliable=NL_INVALID, NLsocket unreliable=NL_INVALID)
 Initializes this object, with optional initial values for the sockets.
The value NL_INVALID should always be used for sockets that are not active.


 ~SocketPair ()
 Since this is just a class to contain the sockets, the sockets are not disconnected on exit.

void disconnect ()
 Calls a low-level disconnect (nlClose) on both sockets, if they are not NL_INVALID, and then sets them to NL_INVALID.

Address getLocalAddress (bool reliable) const
Address getRemoteAddress (bool reliable) const
ConnectionStats getStats (int reliable) const
int rawRead (bool reliable, Buffer &buf) const
 Performs a low-level read on a socket.

int rawWrite (bool reliable, const Buffer &buf) const
 Performs a low-level write on a socket.


Public Attributes

NLsocket r
 The reliable socket.

NLsocket u
 The unreliable socket.


Detailed Description

A class used to centralize shared elements between Connection and SyncConnection. The GNE user will not need to use or know about this class, except to possibly pass it to another Connection type class to "evolve" a SyncConnection to an asyncronous type.


Member Function Documentation

Address GNE::SocketPair::getLocalAddress bool  reliable  )  const
 

See also:
GNE::Connection::getLocalAddress

Address GNE::SocketPair::getRemoteAddress bool  reliable  )  const
 

See also:
GNE::Connection::getRemoteAddress

ConnectionStats GNE::SocketPair::getStats int  reliable  )  const
 

See also:
GNE::Connection::getStats

int GNE::SocketPair::rawRead bool  reliable,
Buffer buf
const
 

Performs a low-level read on a socket.

First, clear is called on the Buffer. Then the read is performed. The number of bytes read is set to be the new limit, and this number is returned. The position is set to 0. Up get getCapacity bytes will be read.

I do know that this is undeseriable functionality but these are the semantics that were used with the old RawPacket, and since SocketPair is an internal GNE class, I kept the semantics. Preferably, the rawRead and rawWrite functions should work based on getRemaining on the Buffer and act as if they are reading or writing bytes from the Buffers, so that their positions change.

Parameters:
reliable select which socket to perform read on.
buf data arrives in this buffer.
Returns:
number of bytes read, and the new limit for buf

int GNE::SocketPair::rawWrite bool  reliable,
const Buffer buf
const
 

Performs a low-level write on a socket.

I do know that this is undeseriable functionality but these are the semantics that were used with the old RawPacket, and since SocketPair is an internal GNE class, I kept the semantics. Preferably, the rawRead and rawWrite functions should work based on getRemaining on the Buffer and act as if they are reading or writing bytes from the Buffers, so that their positions change.

Parameters:
reliable select which socket to perform the write on. If their is no unreliable socket, it is sent on the reliable one instead.
buf data to be sent. The data from the Buffer's 0 position to the Buffer's current position is sent.
Returns:
number of bytes read.


The documentation for this class was generated from the following files:
Generated on Fri Aug 22 13:40:06 2003 for GNE by doxygen1.3