TcpLib
Loading...
Searching...
No Matches
tcp::ServerMessage Class Reference

Is a special Tcp message for the Server. The socket is included so that the server knows to whom it should send the data. More...

#include <TcpMessage.h>

Inheritance diagram for tcp::ServerMessage:
Collaboration diagram for tcp::ServerMessage:

Public Member Functions

 ServerMessage (SOCKET ClientSocket, char *pszTransmitData, std::size_t nTransmitDataSize)
 
 ServerMessage (SOCKET ClientSocket, char *pszRawMsg, std::size_t nRawMsgSize, unsigned int uiMessageID, int iActionCode, const std::string &rstrInfo)
 
virtual ~ServerMessage ()
 
- Public Member Functions inherited from tcp::Message
 Message (char *pszTransmitData, std::size_t nTransmitDataSize)
 
 Message (char *pszRawMsg, std::size_t nRawMsgSize, unsigned int uiMessageID, int iActionCode, const std::string &rstrInfo)
 
virtual ~Message ()
 
char * getRawMsgPt ()
 
std::size_t getRawMsgSize () const
 
char * getTransmitDataPt ()
 
std::size_t getTransmitDataSize () const
 
unsigned int getMsgID () const
 
int getActionCode () const
 
std::string getInfo () const
 
std::size_t getRawMsg (char *&prszRawMsg, bool bCopy=true)
 
std::size_t getTransmitData (char *&prszSendMsg, bool bCopy=true)
 
- Public Member Functions inherited from tcp::AbstractMessage
virtual ~AbstractMessage ()
 
- Public Member Functions inherited from tcp::ServerAcceptMessage
 ServerAcceptMessage (SOCKET NewSocket)
 
virtual ~ServerAcceptMessage ()
 
SOCKET getSocket ()
 
void closeSocket ()
 

Protected Member Functions

 ServerMessage ()
 
 ServerMessage (char *, std::size_t)
 
- Protected Member Functions inherited from tcp::Message
 Message ()
 
- Protected Member Functions inherited from tcp::AbstractMessage
 AbstractMessage ()
 
- Protected Member Functions inherited from tcp::ServerAcceptMessage
 ServerAcceptMessage ()
 

Private Member Functions

 ServerMessage (const ServerMessage &)
 
ServerMessageoperator= (const ServerMessage &)
 

Detailed Description

Is a special Tcp message for the Server. The socket is included so that the server knows to whom it should send the data.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ ServerMessage() [1/5]

tcp::ServerMessage::ServerMessage ( )
protected

This constructor is not available.

◆ ServerMessage() [2/5]

tcp::ServerMessage::ServerMessage ( char * ,
std::size_t  )
protected

This constructor is not available.

◆ ServerMessage() [3/5]

tcp::ServerMessage::ServerMessage ( SOCKET ClientSocket,
char * pszTransmitData,
std::size_t nTransmitDataSize )

Art constructor with parameters.

Parameters
[in]ClientSocketThe client socket.
[in]pszTransmitDataThe data buffer to be transmitted including all required Information:
  • the abbreviation "hja-tcp" (0-terminated) a simple non-secure way to filter foreign messages.
  • the size of the entire message, i.e. header plus message data (0-terminated)
  • A message ID (0-terminated)
  • a ActionCode (0-terminated)
  • an info (0-terminated)
  • the message data of the message
[in]nTransmitDataSizeThe size or length of the data buffer to be sent.
Attention
This object takes over the removal of the pszTransmitData from the memory.
Exceptions
eut::ErrorNExceptionAn exception is thrown if the attributes cannot be set from the data (e.g. because the header is incorrect).

◆ ServerMessage() [4/5]

tcp::ServerMessage::ServerMessage ( SOCKET ClientSocket,
char * pszRawMsg,
std::size_t nRawMsgSize,
unsigned int uiMessageID,
int iActionCode,
const std::string & rstrInfo )

Art constructor with parameters.

Parameters
[in]ClientSocketThe client socket.
[in]pszRawMsgThe message data.
[in]nRawMsgSizeThe size or length of the message data.
[in]uiMessageIDA unique ID.
[in]iActionCodeThe ActionCode, see m_iActionCode.
[in]rstrInfoAn additional text info
Attention
This object removes the pszRawMsg from the memory
Exceptions
eut::ErrorNExceptionIf m_pszTransmitData cannot be set from the data (e.g. because attributes are invalid), an exception is thrown.

◆ ~ServerMessage()

virtual tcp::ServerMessage::~ServerMessage ( )
virtual

Destructor.

◆ ServerMessage() [5/5]

tcp::ServerMessage::ServerMessage ( const ServerMessage & )
private

The copy constructor is not available.

Member Function Documentation

◆ operator=()

ServerMessage & tcp::ServerMessage::operator= ( const ServerMessage & )
private

The assignment operator is not available.


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