Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

NetworkProtocol

This is an archived page!
This page is very old and the content is not up to date.
Not everything (if any) which is written here will be in the final game!

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);

Last modified 16 years ago Last modified on Nov 28, 2007, 12:42:45 AM