Class that communicates with a Server via a SOCKET and delivers its receive result of type Message to its "owner", which must be a Client. You can use the method ClientReceiver::acceptMessage(AbstractMessage * pTcpMessage) to change the delivery to the "owner" in subclasses by overwriting the method.
More...
#include <TcpClientReceiver.h>
|
| ClientReceiver () |
|
| ClientReceiver (SOCKET) |
|
| ClientReceiver (TcpMain *, SOCKET) |
|
| ClientReceiver (TcpMain *, SOCKET, unsigned int) |
|
virtual void | work () override |
|
virtual int | acceptMessage (AbstractMessage *pTcpMessage) override |
|
virtual void | generateNewTcpMessage (AbstractMessage *&prTcpMessage, char *pszTransmitData, unsigned int uiTransmitDataSize) const override |
|
virtual void | generateNewTcpMessage (AbstractMessage *&prTcpMessage, char *pszRawMsg, unsigned int uiRawMsgSize, unsigned int uiMessageID, int iActionCode, const std::string &rstrInfo) const override |
|
| DataReceiver () |
|
| DataReceiver (SOCKET) |
|
| DataReceiver (TcpMain *, SOCKET) |
|
void | initStreamData () |
|
int | processReceivedData (char *pszSentBuffer, unsigned int t_uiSentBufferSize) |
|
| Receiver () |
|
| Receiver (SOCKET Socket) |
|
| ReceiverTransmitter () |
|
void | threadWork () |
|
void | setStatus (STATUS eStatus) |
|
STATUS | getStatus () |
|
void | toOrder (ORDER eOrder) |
|
ORDER | getOrder () |
|
Class that communicates with a Server via a SOCKET and delivers its receive result of type Message to its "owner", which must be a Client. You can use the method ClientReceiver::acceptMessage(AbstractMessage * pTcpMessage) to change the delivery to the "owner" in subclasses by overwriting the method.
- Copyright
- © 2010 Helmut Jakoby
- Author
- Helmut Jakoby
◆ ClientReceiver() [1/6]
tcp::ClientReceiver::ClientReceiver |
( |
| ) |
|
|
protected |
This constructor is not available.
◆ ClientReceiver() [2/6]
tcp::ClientReceiver::ClientReceiver |
( |
SOCKET | | ) |
|
|
protected |
This constructor is not available.
◆ ClientReceiver() [3/6]
tcp::ClientReceiver::ClientReceiver |
( |
TcpMain * | , |
|
|
SOCKET | ) |
|
protected |
This constructor is not available.
◆ ClientReceiver() [4/6]
tcp::ClientReceiver::ClientReceiver |
( |
TcpMain * | , |
|
|
SOCKET | , |
|
|
unsigned int | ) |
|
protected |
This constructor is not available.
◆ ClientReceiver() [5/6]
tcp::ClientReceiver::ClientReceiver |
( |
Client * | pParent, |
|
|
SOCKET | Socket, |
|
|
unsigned int | uiDataSize ) |
Constructor with parameter passing.
- Parameters
-
[in] | pParent | The owning parent object. |
[in] | Socket | The socket through which communication takes place. |
[in] | uiDataSize | The package size. |
- Exceptions
-
◆ ~ClientReceiver()
virtual tcp::ClientReceiver::~ClientReceiver |
( |
| ) |
|
|
virtual |
◆ ClientReceiver() [6/6]
The copy constructor is not available.
◆ acceptMessage()
virtual int tcp::ClientReceiver::acceptMessage |
( |
AbstractMessage * | pTcpMessage | ) |
|
|
overrideprotectedvirtual |
Forwards the transferred message to its Client, which also deletes the message after processing.
The Client can then process these further in subclasses if necessary. If processing in a subclass of ClientReceiver is required, this method can also be overwritten.
- Parameters
-
[in] | pTcpMessage | The received message. |
- Returns
- A return < 0 indicates an error.
- Attention
- The passed object must not be removed from memory by the calling instance.
- See also
- Message
Implements tcp::DataReceiver.
◆ cancel()
virtual void tcp::ClientReceiver::cancel |
( |
| ) |
|
|
overridevirtual |
◆ connected()
bool tcp::ClientReceiver::connected |
( |
| ) |
const |
Is connected?
- Returns
- If true, the client Receiver has a SOCKET.
◆ generateNewTcpMessage() [1/2]
virtual void tcp::ClientReceiver::generateNewTcpMessage |
( |
AbstractMessage *& | prTcpMessage, |
|
|
char * | pszRawMsg, |
|
|
unsigned int | uiRawMsgSize, |
|
|
unsigned int | uiMessageID, |
|
|
int | iActionCode, |
|
|
const std::string & | rstrInfo ) const |
|
overrideprotectedvirtual |
Generates a Message from transferred parameters.
- Parameters
-
[in,out] | prTcpMessage | Pointer to newly generated Message. This object takes over the removal of the pszRawMsg from the memory. |
[in] | pszRawMsg | The message data. |
[in] | uiRawMsgSize | The size or length of the message data. |
[in] | uiMessageID | A unique ID. |
[in] | iActionCode | The ActionCode. |
[in] | rstrInfo | An additional text info |
- Attention
- The supplied object must be removed from memory by the calling instance.
- Exceptions
-
- See also
- Message
Implements tcp::DataReceiver.
◆ generateNewTcpMessage() [2/2]
virtual void tcp::ClientReceiver::generateNewTcpMessage |
( |
AbstractMessage *& | prTcpMessage, |
|
|
char * | pszTransmitData, |
|
|
unsigned int | uiTransmitDataSize ) const |
|
overrideprotectedvirtual |
Generates a Message from the transferred data buffer and its size.
- Parameters
-
[in,out] | prTcpMessage | Pointer to newly generated Message. This object takes care of removing the pszTransmitData from the memory. |
[in] | pszTransmitData | The data buffer including all required information. |
[in] | uiTransmitDataSize | The size or length of the data buffer to be sent. |
- Attention
- The supplied object must be removed from memory by the calling instance.
- Exceptions
-
eut::ErrorNException | If no Message can be instantiated from the data (because, for example, the header is incorrect), an exception is thrown. |
- See also
- Message
Implements tcp::DataReceiver.
◆ operator=()
The assignment operator is not available.
◆ work()
virtual void tcp::ClientReceiver::work |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ m_bHaveConnection
bool tcp::ClientReceiver::m_bHaveConnection |
|
private |
Auxiliary variable to indicate whether a connection is already established.
The documentation for this class was generated from the following file: