NetworkBuffer now has valid parameter
Removed NetworkBuffer variable in NetworkMessage TcpClient DataAvailable parameter type is now int32 Fixed NetworkMessage::EncododeMessage to put the size in the Buffer's header and to validate and fixed DecodeMessage to check the buffer's valid variable Fixed some methods in TcpClientWindows
This commit is contained in:
@ -17,6 +17,8 @@ struct NetworkBuffer
|
||||
|
||||
std::vector<byte> header; // size must always be 8
|
||||
std::vector<byte> body;
|
||||
|
||||
bool valid = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -12,7 +12,7 @@ struct NetworkMessage
|
||||
{
|
||||
NetworkMessage();
|
||||
NetworkMessage(const NetworkBuffer &buffer);
|
||||
NetworkMessage(uint16 sender, byte distribution_mode, uint16 destination_id, byte tag, byte subject, NetworkBuffer buffer);
|
||||
NetworkMessage(uint16 sender, byte distribution_mode, uint16 destination_id, byte tag, byte subject);
|
||||
~NetworkMessage();
|
||||
|
||||
static const NetworkBuffer &EncodeMessage(const NetworkMessage &message);
|
||||
@ -27,9 +27,6 @@ struct NetworkMessage
|
||||
void *data;
|
||||
|
||||
bool valid = false;
|
||||
|
||||
private:
|
||||
NetworkBuffer buffer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -35,7 +35,7 @@ public:
|
||||
|
||||
bool Connect();
|
||||
|
||||
bool DataAvailable(uint16 &size);
|
||||
bool DataAvailable(int32 &size);
|
||||
|
||||
//this method will receive the messages automaticaly and use the callback methods
|
||||
void ReceiveMessages();
|
||||
|
||||
Reference in New Issue
Block a user