Nebula
|
#include <messageclientconnection.h>
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::Stream > | sendMessageStream |
Ptr< IO::Stream > | recvMessageStream |
Util::Queue< Ptr< IO::Stream > > | msgQueue |
TcpMessageCodec | codec |
Net::MessageClientConnection::MessageClientConnection | ( | ) |
Constructor.
|
virtual |
Destructor
|
private |
|
virtual |
access to recv stream
Returns the stream with the received data
|
virtual |
access to send stream
Returns the stream to which data for sending is written.
|
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.
|
virtual |
send accumulated content of send stream to server
Writes accumulated send stream into a message container and sends this container.
|
virtual |
directly send a stream to the server, often prevents a memory copy
Writes given stream into a message container and sends this container.
|
virtual |
shutdown the connection
This disconnects the current connection.
|
private |
|
private |
|
private |
|
private |