The Nebula Device 3: Net::MessageClientConnection Class Reference

The Nebula Device 3

Net::MessageClientConnection Class Reference

#include <messageclientconnection.h>

Inheritance diagram for Net::MessageClientConnection:

Net::TcpClientConnection Net::StdTcpClientConnection Core::RefCounted

Detailed Description

A wrapper class for the Net::TcpClientConnection.

All data that is send by using Send() will streamed into a container, before it will send to the client. The message contains information about the full length of the data. This way the receiving site can handle messages that are splittet into chunks and may wait until a full message was received.

The MessageClientConnection will concatenate incoming data chunks to full messages and Recv() will only return finished messages.

(C) 2009 Radon Labs GmbH

Public Member Functions

 MessageClientConnection ()
virtual ~MessageClientConnection ()
virtual bool Connect (const Ptr< Socket > &s)
 connect using provided socket
virtual void Shutdown ()
 shutdown the connection
virtual Socket::Result Send ()
 send accumulated content of send stream to server
virtual Socket::Result Send (const Ptr< IO::Stream > &stream)
 directly send a stream to the server, often prevents a memory copy
virtual const Ptr< IO::Stream > & GetSendStream ()
 access to send stream
virtual Socket::Result Recv ()
 receive data from server into recv stream
virtual const Ptr< IO::Stream > & GetRecvStream ()
 access to recv stream
bool IsConnected () const
 get the connection status
const IpAddressGetClientAddress () const
 get the client's ip address
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Static Public Member Functions

static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

Constructor & Destructor Documentation

Net::MessageClientConnection::MessageClientConnection (  ) 

Constructor

Net::MessageClientConnection::~MessageClientConnection (  )  [virtual]

Destructor


Member Function Documentation

bool Net::MessageClientConnection::Connect ( const Ptr< Socket > &  s  )  [virtual]

connect using provided socket

Connect using provided socket. See TcpClientConnection for details.

Reimplemented from Net::StdTcpClientConnection.

void Net::MessageClientConnection::Shutdown (  )  [virtual]

shutdown the connection

This disconnects the current connection.

Reimplemented from Net::StdTcpClientConnection.

Socket::Result Net::MessageClientConnection::Send (  )  [virtual]

send accumulated content of send stream to server

Writes accumulated send stream into a message container and sends this container.

Reimplemented from Net::StdTcpClientConnection.

Socket::Result Net::MessageClientConnection::Send ( const Ptr< IO::Stream > &  stream  )  [virtual]

directly send a stream to the server, often prevents a memory copy

Writes given stream into a message container and sends this container.

Reimplemented from Net::StdTcpClientConnection.

const Ptr< IO::Stream > & Net::MessageClientConnection::GetSendStream (  )  [virtual]

access to send stream

Returns the stream to which data for sending is written.

Reimplemented from Net::StdTcpClientConnection.

Socket::Result Net::MessageClientConnection::Recv (  )  [virtual]

receive data from server into recv stream

Receive data from the clients, but returns only Success, if a complete message was available. This message will either return one complete message, or none at all.

Reimplemented from Net::StdTcpClientConnection.

const Ptr< IO::Stream > & Net::MessageClientConnection::GetRecvStream (  )  [virtual]

access to recv stream

Returns the stream with the received data

Reimplemented from Net::StdTcpClientConnection.

int Core::RefCounted::GetRefCount (  )  const [inline, inherited]

get the current refcount

Return the current refcount of the object.

void Core::RefCounted::AddRef (  )  [inline, inherited]

increment refcount by one

Increment the refcount of the object.

void Core::RefCounted::Release (  )  [inline, inherited]

decrement refcount and destroy object if refcount is zero

Decrement the refcount and destroy object if refcount is zero.

const Util::String & Core::RefCounted::GetClassName (  )  const [inline, inherited]

get the class name

Get the class name of the object.

Util::FourCC Core::RefCounted::GetClassFourCC (  )  const [inline, inherited]

get the class FourCC code

Get the class FourCC of the object.

void Core::RefCounted::DumpRefCountingLeaks (  )  [static, inherited]

dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

This method should be called as the very last before an application exits.