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

osg::MulticastConnection Class Reference

Stream socket connection. More...

#include <OSGMulticastConnection.h>

Inheritance diagram for osg::MulticastConnection:

Inheritance graph
[legend]
Collaboration diagram for osg::MulticastConnection:

Collaboration graph
[legend]
List of all members.

Alive thread handling

void startAliveThread ()
 Start alive thread.

void stopAliveThread ()
 Stop alive thread.

BaseThread_aliveThread
 Start alive thread.

bool _stopAliveThread
 Start alive thread.

void * aliveProc (void *arg)
 Start alive thread.


Public Methods

Constructors
 MulticastConnection (int port=0)
 Constructor.

Destructor
virtual ~MulticastConnection (void)
 Destructor.

your_category
string bind (const string &address)
 Bind connection to the givven address.

void accept (void)
 Wait for incommint connections on the given address.

void connect (const string &address)
 connect a connection at the given address

void wait (void)
 wait for sync

void signal (void)
 send sync

UInt32 getChannelCount (void)
 get number of links

void selectChannel (void)
 select channel for read

const ConnectionTypegetType (void)
 Get type of connection.


Static Public Methods

create
Connectioncreate (void)
 create conneciton


Protected Types

typedef vector< vector< UInt8 > > UDPBuffersT
enum  UDPHeaderType {
  ACK_REQUEST, ACK, DATA, ALIVE,
  SYNC, CONNECT, CLOSED
}

Protected Methods

read/write
virtual void readBuffer (void)
 Write buffer.

virtual void writeBuffer (void)
 Write buffer.

address handling
void interpreteAddress (const string &address, string &group, UInt32 &port, UInt32 &member)
 nterprete address


Protected Attributes

Member
vector< SocketAddress_channelAddress
vector< UInt32_channelSeqNumber
UInt32 _channel
UInt32 _seqNumber
UDPBuffersT _udpReadBuffers
UDPBuffersT _udpWriteBuffers
Time _maxWaitForAck
Time _waitForAck
Time _maxWaitForSync
DgramSocket _socket
DgramSocket _inSocket
DgramSocket _groupSocket
DgramSocket _aliveSocket
SocketAddress _destination
UInt32 _member
Time _aliveTime

Private Types

typedef Connection Inherited

Private Methods

 MulticastConnection (const MulticastConnection &source)
 prohibit default function (move to 'public' if needed)

void operator= (const MulticastConnection &source)

Static Private Attributes

Class Variable
ConnectionType _type

Friends

struct UDPBuffer

Detailed Description

Stream socket connection.

Author:
Marcus Roth
The StreamSockConnection implements the Connection interface. It uses UDP to establish a reliable multicast connection.

Multicast address syntax: group:port:id. The id is used to distinguish two clients at the same host, using the same port. Bind is able to generate a unique id if no id is given.

Connect:

 UInt32 intv=1234;
 MulticastConnection con;
 con.connect( "224.100.100.100:3333:1" );
 con.connect( "224.100.100.100:3333:2" );
 con.connect( "224.100.100.100:3333:3" );
 con.putValue(intv);
 con.flush();
 

Accept:

 MulticastConnection con;
 con.bind("224.100.100.100:3333:1");
 con.accept();
 con.selectChannel();
 UInt32 x;
 con.getValue(x);
 


Member Typedef Documentation

typedef vector<vector<UInt8> > osg::MulticastConnection::UDPBuffersT [protected]
 

typedef Connection osg::MulticastConnection::Inherited [private]
 

Reimplemented from osg::Connection.


Member Enumeration Documentation

enum osg::MulticastConnection::UDPHeaderType [protected]
 

Enumeration values:
ACK_REQUEST 
ACK 
DATA 
ALIVE 
SYNC 
CONNECT 
CLOSED 


Constructor & Destructor Documentation

MulticastConnection::MulticastConnection int    port = 0
 

Constructor.

MulticastConnection::~MulticastConnection void    [virtual]
 

Destructor.

osg::MulticastConnection::MulticastConnection const MulticastConnection &    source [private]
 

prohibit default function (move to 'public' if needed)


Member Function Documentation

string MulticastConnection::bind const string &    address [virtual]
 

Bind connection to the givven address.

Describes, on which port the connection will accept incomming connecitons. If the address string contains no id, then a random id will be choosen. If group is empty, then 224.11.12.50 is used.

Parameters:
address  string with group:Port:id
Returns:
port:id

Implements osg::Connection.

void MulticastConnection::accept void    [virtual]
 

Wait for incommint connections on the given address.

Implements osg::Connection.

void MulticastConnection::connect const string &    address [virtual]
 

connect a connection at the given address

Parameters:
address  Host:Port:Id

Implements osg::Connection.

void MulticastConnection::wait void    [virtual]
 

wait for sync

Implements osg::Connection.

void MulticastConnection::signal void    [virtual]
 

send sync

Implements osg::Connection.

UInt32 MulticastConnection::getChannelCount void    [virtual]
 

get number of links

Implements osg::Connection.

void MulticastConnection::selectChannel void    [virtual]
 

select channel for read

A connection can have n links from which data can be read. So we need to select one channel for exclusive read.

Implements osg::Connection.

const ConnectionType * MulticastConnection::getType void    [virtual]
 

Get type of connection.

Returns:
ConnectionType pointer

Implements osg::Connection.

Connection * MulticastConnection::create void    [static]
 

create conneciton

void MulticastConnection::readBuffer void    [protected, virtual]
 

Write buffer.

A simple reliable UDP package protocoll is used.

  • write all packages as fast as possible
  • wait some time for acknolages
  • if unacknolaged packages, then retransmit and go to 2

Reimplemented from osg::BinaryDataHandler.

void MulticastConnection::writeBuffer void    [protected, virtual]
 

Write buffer.

A simple reliable UDP package protocoll is used.

  • read data
  • if acknolage request, the acknolage already read data
See also:
writeBuffer

Reimplemented from osg::BinaryDataHandler.

void MulticastConnection::interpreteAddress const string &    address,
string &    group,
UInt32   port,
UInt32   member
[protected]
 

nterprete address

multicastgroup:port:client

void MulticastConnection::startAliveThread   [private]
 

Start alive thread.

To enable the receiver to detect a canceled sender, we need an alive signal avery n seconds. Then the receiver is able to set it's timeout to n+1

void MulticastConnection::stopAliveThread   [private]
 

Stop alive thread.

void * MulticastConnection::aliveProc void *    arg [static, private]
 

Start alive thread.

Send an alive package after _aliveTime

void osg::MulticastConnection::operator= const MulticastConnection &    source [private]
 


Friends And Related Function Documentation

friend struct UDPBuffer [friend]
 


Member Data Documentation

vector<SocketAddress> osg::MulticastConnection::_channelAddress [protected]
 

vector<UInt32> osg::MulticastConnection::_channelSeqNumber [protected]
 

UInt32 osg::MulticastConnection::_channel [protected]
 

UInt32 osg::MulticastConnection::_seqNumber [protected]
 

UDPBuffersT osg::MulticastConnection::_udpReadBuffers [protected]
 

UDPBuffersT osg::MulticastConnection::_udpWriteBuffers [protected]
 

Time osg::MulticastConnection::_maxWaitForAck [protected]
 

Time osg::MulticastConnection::_waitForAck [protected]
 

Time osg::MulticastConnection::_maxWaitForSync [protected]
 

DgramSocket osg::MulticastConnection::_socket [protected]
 

DgramSocket osg::MulticastConnection::_inSocket [protected]
 

DgramSocket osg::MulticastConnection::_groupSocket [protected]
 

DgramSocket osg::MulticastConnection::_aliveSocket [protected]
 

SocketAddress osg::MulticastConnection::_destination [protected]
 

UInt32 osg::MulticastConnection::_member [protected]
 

Time osg::MulticastConnection::_aliveTime [protected]
 

ConnectionType MulticastConnection::_type [static, private]
 

BaseThread* osg::MulticastConnection::_aliveThread [private]
 

Start alive thread.

To enable the receiver to detect a canceled sender, we need an alive signal avery n seconds. Then the receiver is able to set it's timeout to n+1

bool osg::MulticastConnection::_stopAliveThread [private]
 

Start alive thread.

To enable the receiver to detect a canceled sender, we need an alive signal avery n seconds. Then the receiver is able to set it's timeout to n+1


The documentation for this class was generated from the following files:
Generated on Wed Jul 3 16:32:31 2002 for OpenSG by doxygen1.2.16