Class that communicates with a Client via a SOCKET and delivers its receive result of type ServerMessage to its "owner", which must be a Server. You can use the method ServerReceiver::acceptMessage(AbstractMessage * pTcpMessage) to change the delivery to the "owner" in subclasses by overwriting the method.
More...
#include <TcpServerReceiver.h>
|
| ServerReceiver () |
|
| ServerReceiver (SOCKET) |
|
| ServerReceiver (TcpMain *, SOCKET) |
|
| ServerReceiver (TcpMain *, SOCKET, unsigned int) |
|
virtual int | acceptMessage (AbstractMessage *pTcpServerMessage) override |
|
virtual void | generateNewTcpMessage (AbstractMessage *&prTcpServerMessage, char *pszRawMsg, unsigned int uiRawMsgSize, unsigned int uiMessageID, int iActionCode, const std::string &rstrInfo) const override |
|
virtual void | generateNewTcpMessage (AbstractMessage *&prTcpServerMessage, char *pszTransmitData, unsigned int uiTransmitDataSize) const override |
|
virtual void | work () override |
|
| DataReceiver () |
|
| DataReceiver (SOCKET) |
|
| DataReceiver (TcpMain *, SOCKET) |
|
void | initStreamData () |
|
int | processReceivedData (char *pszSentBuffer, unsigned int t_uiSentBufferSize) |
|
| Receiver () |
|
| Receiver (SOCKET Socket) |
|
| ReceiverTransmitter () |
|
ORDER | getOrder () |
|
STATUS | getStatus () |
|
void | setStatus (STATUS eStatus) |
|
void | threadWork () |
|
void | toOrder (ORDER eOrder) |
|
Class that communicates with a Client via a SOCKET and delivers its receive result of type ServerMessage to its "owner", which must be a Server. You can use the method ServerReceiver::acceptMessage(AbstractMessage * pTcpMessage) to change the delivery to the "owner" in subclasses by overwriting the method.
- Copyright
- © 2010 Helmut Jakoby
- Author
- Helmut Jakoby
◆ ServerReceiver() [1/6]
tcp::ServerReceiver::ServerReceiver |
( |
| ) |
|
|
protected |
This constructor is not available.
◆ ServerReceiver() [2/6]
tcp::ServerReceiver::ServerReceiver |
( |
SOCKET | | ) |
|
|
protected |
This constructor is not available.
◆ ServerReceiver() [3/6]
tcp::ServerReceiver::ServerReceiver |
( |
TcpMain * | , |
|
|
SOCKET | ) |
|
protected |
This constructor is not available.
◆ ServerReceiver() [4/6]
tcp::ServerReceiver::ServerReceiver |
( |
TcpMain * | , |
|
|
SOCKET | , |
|
|
unsigned int | ) |
|
protected |
This constructor is not available.
◆ ServerReceiver() [5/6]
tcp::ServerReceiver::ServerReceiver |
( |
Server * | 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
-
◆ ~ServerReceiver()
virtual tcp::ServerReceiver::~ServerReceiver |
( |
| ) |
|
|
virtual |
◆ ServerReceiver() [6/6]
The copy constructor is not available.
◆ acceptMessage()
virtual int tcp::ServerReceiver::acceptMessage |
( |
AbstractMessage * | pTcpServerMessage | ) |
|
|
overrideprotectedvirtual |
Forwards the transferred message to its Server, which also deletes the message after processing.
The Server 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] | pTcpServerMessage | 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
- ServerMessage
Implements tcp::DataReceiver.
Reimplemented in glo::TcpServerReceiver.
◆ cancel()
virtual void tcp::ServerReceiver::cancel |
( |
| ) |
|
|
overridevirtual |
◆ generateNewTcpMessage() [1/2]
virtual void tcp::ServerReceiver::generateNewTcpMessage |
( |
AbstractMessage *& | prTcpServerMessage, |
|
|
char * | pszRawMsg, |
|
|
unsigned int | uiRawMsgSize, |
|
|
unsigned int | uiMessageID, |
|
|
int | iActionCode, |
|
|
const std::string & | rstrInfo ) const |
|
overrideprotectedvirtual |
Generates a ServerMessage from transferred parameters.
- Parameters
-
[in,out] | prTcpServerMessage | Pointer to newly generated ServerMessage. 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
- ServerMessage
Implements tcp::DataReceiver.
◆ generateNewTcpMessage() [2/2]
virtual void tcp::ServerReceiver::generateNewTcpMessage |
( |
AbstractMessage *& | prTcpServerMessage, |
|
|
char * | pszTransmitData, |
|
|
unsigned int | uiTransmitDataSize ) const |
|
overrideprotectedvirtual |
Generates a ServerMessage from the transferred data buffer and its size.
- Parameters
-
[in,out] | prTcpServerMessage | Pointer to newly generated ServerMessage. 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
-
- See also
- ServerMessage
Implements tcp::DataReceiver.
◆ operator=()
The assignment operator is not available.
◆ setValid()
void tcp::ServerReceiver::setValid |
( |
bool | bValid | ) |
|
Called when socket is no longer ok.
- Parameters
-
[in] | bValid | If there is a SOCKET error, false is passed here. |
◆ work()
virtual void tcp::ServerReceiver::work |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ m_bValid
bool tcp::ServerReceiver::m_bValid |
|
protected |
Set to false if socket is no longer ok.
The documentation for this class was generated from the following file: