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

osg::StreamSockConnection Class Reference

Stream socket connection. More...

#include <OSGStreamSockConnection.h>

Inheritance diagram for osg::StreamSockConnection:

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef Connection Inherited
typedef std::vector< StreamSocketSocketsT
typedef std::vector< UInt8SocketBufferT

Public Methods

Constructor
 StreamSockConnection ()
 Constructor.

Destructor
virtual ~StreamSockConnection (void)
 Destructor.

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

void accept (void)
 Wait for incommint connections on the bound port.

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

void wait (void)
 wait for sync signal

void signal (void)
 send synchronisaiton signale

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 Methods

IO Implementation
virtual void read (MemoryHandle mem, UInt32 size)
 Read data into given memory.

virtual void readBuffer ()
 Read next data block.

virtual void write (MemoryHandle mem, UInt32 size)
 Write data to all destinations.

virtual void writeBuffer ()
 Write buffer.

void interpreteAddress (const string &address, string &host, UInt32 &port)
 Interprete an address string.


Protected Attributes

Instance Variables
StreamSocket _acceptSocket
StreamSocket _readSocket
SocketsT _sockets
std::vector< UInt8_socketReadBuffer
std::vector< UInt8_socketWriteBuffer

Private Methods

Copy
 StreamSockConnection (const StreamSockConnection &source)
StreamSockConnection & operator= (const StreamSockConnection &source)

Static Private Attributes

Class Variable
char cvsid [] = "@(#)$Id:$"
ConnectionType _type

Detailed Description

Stream socket connection.

Author:
Marcus Roth
The StreamSockConnection implements the Connection interface

Connect:

 StreamSockConnection con;
 con.connect( "dagobert:3333" );
 con.connect( "donald:3333" );
 con.connect( "tric:3333" );
 con.putUInt32(1234);
 con.flush();
 

Accept:

 StreamSockConnection con;
 con.bind("3333");
 con.accept();
 con.selectChannel();
 UInt32 x;
 con.getUInt32(x);
 


Member Typedef Documentation

typedef Connection osg::StreamSockConnection::Inherited
 

Reimplemented from osg::Connection.

typedef std::vector<StreamSocket> osg::StreamSockConnection::SocketsT
 

typedef std::vector<UInt8> osg::StreamSockConnection::SocketBufferT
 


Constructor & Destructor Documentation

StreamSockConnection::StreamSockConnection  
 

Constructor.

Initialize a StreamSockConnection. By default a buffer of 16000 bytes is used.

StreamSockConnection::~StreamSockConnection void    [virtual]
 

Destructor.

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


Member Function Documentation

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

Bind connection to the givven address.

Parameters:
address  Port number

Implements osg::Connection.

void StreamSockConnection::accept void    [virtual]
 

Wait for incommint connections on the bound port.

Implements osg::Connection.

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

connect a connection at the given address

Parameters:
address  Host:Port

Implements osg::Connection.

void StreamSockConnection::wait void    [virtual]
 

wait for sync signal

Implements osg::Connection.

void StreamSockConnection::signal void    [virtual]
 

send synchronisaiton signale

Implements osg::Connection.

UInt32 StreamSockConnection::getChannelCount void    [virtual]
 

get number of links

Implements osg::Connection.

void StreamSockConnection::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 * StreamSockConnection::getType void    [virtual]
 

Get type of connection.

Returns:
ConnectionType pointer

Implements osg::Connection.

Connection * StreamSockConnection::create void    [static]
 

create conneciton

void StreamSockConnection::read MemoryHandle    mem,
UInt32    size
[protected, virtual]
 

Read data into given memory.

Read data form the current read socket. The read socket is that socket, that was selectet in selectChannel.

Reimplemented from osg::BinaryDataHandler.

void StreamSockConnection::readBuffer void    [protected, virtual]
 

Read next data block.

The stream connection uses only BinaryDataHandler buffer. If more then one buffer is present, then this methode must be changed!

Reimplemented from osg::BinaryDataHandler.

void StreamSockConnection::write MemoryHandle    mem,
UInt32    size
[protected, virtual]
 

Write data to all destinations.

Parameters:
mem  Pointer to data buffer
size  Size of bytes to write

Reimplemented from osg::BinaryDataHandler.

void StreamSockConnection::writeBuffer void    [protected, virtual]
 

Write buffer.

Write blocksize and data.

Reimplemented from osg::BinaryDataHandler.

void StreamSockConnection::interpreteAddress const string &    address,
string &    host,
UInt32   port
[protected]
 

Interprete an address string.

Hoststring syntax is host:port or :port or port

Parameters:
address  Address string
host  Hostname
port  Port number

StreamSockConnection& osg::StreamSockConnection::operator= const StreamSockConnection &    source [private]
 


Member Data Documentation

StreamSocket osg::StreamSockConnection::_acceptSocket [protected]
 

StreamSocket osg::StreamSockConnection::_readSocket [protected]
 

SocketsT osg::StreamSockConnection::_sockets [protected]
 

std::vector<UInt8> osg::StreamSockConnection::_socketReadBuffer [protected]
 

std::vector<UInt8> osg::StreamSockConnection::_socketWriteBuffer [protected]
 

char StreamSockConnection::cvsid = "@(#)$Id:$" [static, private]
 

ConnectionType StreamSockConnection::_type [static, private]
 


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