Nebula
Loading...
Searching...
No Matches
Net::MessageClientConnection Class Reference

#include <messageclientconnection.h>

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.

Inherits TcpClientConnection.

Public Member Functions

 MessageClientConnection ()
 Constructor.
 
virtual ~MessageClientConnection ()
 Destructor

 
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
 

Private Member Functions

 __DeclareClass (MessageClientConnection)
 

Private Attributes

Ptr< IO::StreamsendMessageStream
 
Ptr< IO::StreamrecvMessageStream
 
Util::Queue< Ptr< IO::Stream > > msgQueue
 
TcpMessageCodec codec
 

Constructor & Destructor Documentation

◆ MessageClientConnection()

Net::MessageClientConnection::MessageClientConnection ( )

Constructor.

◆ ~MessageClientConnection()

Net::MessageClientConnection::~MessageClientConnection ( )
virtual

Destructor

Member Function Documentation

◆ __DeclareClass()

Net::MessageClientConnection::__DeclareClass ( MessageClientConnection )
private

◆ Connect()

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

connect using provided socket

Connect using provided socket.

See TcpClientConnection for details.

◆ GetRecvStream()

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

access to recv stream

Returns the stream with the received data

◆ GetSendStream()

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

access to send stream

Returns the stream to which data for sending is written.

◆ Recv()

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.

◆ Send() [1/2]

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.

◆ Send() [2/2]

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.

◆ Shutdown()

void Net::MessageClientConnection::Shutdown ( )
virtual

shutdown the connection

This disconnects the current connection.

Member Data Documentation

◆ codec

TcpMessageCodec Net::MessageClientConnection::codec
private

◆ msgQueue

Util::Queue<Ptr<IO::Stream> > Net::MessageClientConnection::msgQueue
private

◆ recvMessageStream

Ptr<IO::Stream> Net::MessageClientConnection::recvMessageStream
private

◆ sendMessageStream

Ptr<IO::Stream> Net::MessageClientConnection::sendMessageStream
private

The documentation for this class was generated from the following files: