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

GNE::ConnectionParams Class Reference
[Mid-Level API]

#include <ConnectionParams.h>

List of all members.

Public Member Functions

 ConnectionParams ()
 Creates a new ConnectionParams object using the default values, and not setting the listener property.

 ConnectionParams (const SmartPtr< ConnectionListener > &Listener)
 Creates a new ConnectionParams object using the default values, and setting the listener property.

bool checkParams () const
 Returns true if any of the parameters are invalid or out of range.

 operator bool () const
 Returns the result of checkParams.

void setListener (const SmartPtr< ConnectionListener > &Listener)
 The ConnectionListener that will receive events from the Connection.

const SmartPtr< ConnectionListener > & getListener () const
 Returns the value set by getListener.

void setFeeder (const SmartPtr< PacketFeeder > &Feeder)
 The PacketFeeder receives onLowPackets events which are entirely independant of the serialized event queue of events sent to the ConnectionListener.

const SmartPtr< PacketFeeder > & getFeeder () const
 Returns the value set by setFeeder.

void setFeederTimeout (int FeederTimeout)
 Sets the timeout of the PacketFeeder for this Connection.

int getFeederTimeout () const
 Returns the value set by setFeederTimeout.

void setLowPacketThreshold (int limit)
 The low packet threshold for the PacketFeeder.

int getLowPacketThreshold () const
 Returns the value set by setLowPacketThreshold.

void setTimeout (int ms)
 Sets the timeout for this connection in milliseconds.

int getTimeout () const
 Gets the timeout.

void setOutRate (int OutRate)
 The maximum rate we will transmit in bytes per second.

int getOutRate () const
 Returns the value set by setOutRate.

void setInRate (int InRate)
 The maximum rate we allow the sender to send to us in bytes per second.

int getInRate () const
 Returns the value set by setInRate.

void setRates (int OutRate, int InRate)
 A shortcut to set both rates at the same time.

void setLocalPort (int LocalPort)
 For client-side connections, this will set a local port, if you desire, although most of the time you will want to keep this at its default value of 0 to let the OS pick the local port for you.

int getLocalPort () const
 Returns the value set by setLocalPort.

void setUnrel (bool set)
 Set this to true if you want to be able to send unreliable packets over this connection.

bool getUnrel () const
 Returns the value set by setUnrel.


Detailed Description

A class to encapsulate parameters about a connection. The parameter list was starting to get very complex, and I knew in the future that I wanted to expand the list of parameters, and perhaps change the defaults. This class when constructed sets everything to defaults, so change only the parameters that you care about.

Many of the methods in this class are not thread-safe, so instances of this class should not be shared between threads. Copies can be made of objects of this class, though, should sharing be needed.


Constructor & Destructor Documentation

GNE::ConnectionParams::ConnectionParams  ) 
 

Creates a new ConnectionParams object using the default values, and not setting the listener property.

A non-NULL listener is always needed by the time it comes active, so it is almost always specified.

GNE::ConnectionParams::ConnectionParams const SmartPtr< ConnectionListener > &  Listener  ) 
 

Creates a new ConnectionParams object using the default values, and setting the listener property.

A non-NULL listener is always needed by the time it comes active, so it is almost always specified.


Member Function Documentation

void GNE::ConnectionParams::setFeeder const SmartPtr< PacketFeeder > &  Feeder  ) 
 

The PacketFeeder receives onLowPackets events which are entirely independant of the serialized event queue of events sent to the ConnectionListener.

The default is NULL, and any point is valid.

See also:
PacketStream::setFeeder

void GNE::ConnectionParams::setFeederTimeout int  FeederTimeout  ) 
 

Sets the timeout of the PacketFeeder for this Connection.

Default is 0 meaning no timeouts generated. Valid values are 0 and positive integers given in milliseconds.

See also:
PacketStream::setFeederTimeout

void GNE::ConnectionParams::setInRate int  InRate  ) 
 

The maximum rate we allow the sender to send to us in bytes per second.

If this is 0, then the requested incoming rate has no bounds. Valid values are 0 or a positive integer.

The default in rate is 0 (unlimited).

void GNE::ConnectionParams::setListener const SmartPtr< ConnectionListener > &  Listener  ) 
 

The ConnectionListener that will receive events from the Connection.

Valid value is any non-NULL pointer.

void GNE::ConnectionParams::setLocalPort int  LocalPort  ) 
 

For client-side connections, this will set a local port, if you desire, although most of the time you will want to keep this at its default value of 0 to let the OS pick the local port for you.

Valid values are [0..65535].

This option is ignored for ServerConnection.

void GNE::ConnectionParams::setLowPacketThreshold int  limit  ) 
 

The low packet threshold for the PacketFeeder.

Default value is 0, 0 or any positive integer is valid.

See also:
PacketStream::setLowPacketThreshold

void GNE::ConnectionParams::setOutRate int  OutRate  ) 
 

The maximum rate we will transmit in bytes per second.

If this is 0, then the rate is unlimited. Valid values are 0 or a positive integer.

The default out rate is 0 (unlimited).

void GNE::ConnectionParams::setTimeout int  ms  ) 
 

Sets the timeout for this connection in milliseconds.

A value of 0 signifies that no timeouts should occur. Values less than 0 are invalid.

See also:
Connection::setTimeout

void GNE::ConnectionParams::setUnrel bool  set  ) 
 

Set this to true if you want to be able to send unreliable packets over this connection.

Setting this to false will provide a reliable-only connection, so packets sent unreliably will instead be sent reliably.

An unreliable connection is created only when both sides agree to open one by setting this parameter to true. A reliable connection is available regardless of this setting.

The default for unreliable is false.


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