Planet
navihomeaboutscreenshotsdownloaddevelopmentforum

archive/NetworkProtocol

NetworkProtocol

Error: Failed to load processor ArchivePage
No macro or processor named 'ArchivePage' found

Short description of the module and its functions:

Next steps:

  • remove Version Nr Entry
  • merge senderID and receiverID -> synchronizeableID

Network Header:

1 byte 1 byte
synchronizeableID Payload length



/* general notes:
    - The network protocol creates and reads the header of a network packet. 
*/

 /* public functions */
 public:
  
 /*
  * This constructor creates a new DataStream and connects it to both streams (upStream, downStream)
  */
  NetworkProtocol();

 /*
  * creates a new packet header from the function arguments
  *
  * @arg data: the binary data without header -> return the data in this binary array
  * @arg length: the data length without header
  * @arg bufferLength: the length of the internal buffer
  * @arg source: reference to the source Synchronizeable object
  * @arg remoteID: id number of the remote Synchronizeable object
  * @return: the new data length with header (the header data is included into byte* data)
  */
  int createHeader(byte* data, int length, int bufferLength, const Synchronizeable& source, unsigned int remoteID);


 /*
  * remove the header from the binary data stream and returns a pointer to the 
  * destination object
  */
  Synchronizeable& removeHeader(byte* data, int length);