Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 5 (modified by landauf, 7 years ago) (diff)

fixed links

NetworkStream

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!

Next steps:



/* public: */

/*
 * Standard constructor for testing purposes
 */
 NetworkStream();

/*
 * Constructor for the network stream that is called from the NetworkManager. The constructor
 * will generate the NetworkSocket from the IPaddress information.
 *
 * @param address: the address information (SDL_net.h definition) of the remote host
 * @param sync: the synchronizeable object, the other end of the connection
 * @param type: the node type: Client/Server
 */
 NetworkStream(IPaddress& address, const Synchronizeable& sync, NodeType type);


/*
 * Constructor for the network stream that is called from the NetworkManager
 *
 * @param sync: the synchronizeable object, the other end of the connection
 * @param type: the node type: Client/Server
 */
 NetworkStream(const Synchronizeable& sync, NodeType type);



 /*
  * Passes the data from the Network socket to the synchronizeable socket and vice versa (take a look
  * at the UML Sequenca Graph). At the end of the transaction, the ConnectionMonitor will be kicked on.
  */
 void processData();
      
/* protected: */

 /*
  * Is invoked by the processData() function and passes the data from the synchronizeable object to the
  * NetworkSocket.
  * This function is an implementation of the virtual void DataStream::passDown(byte* data, int length) function.
  *
  * 1. get the data from the Synchronizeable object by calling: Synchronizeable::readBytes(byte* data)
  * 2. save the data locally
  * 3. pass the data to the NetworkSocket by calling NetworkSocket::writeBytes(byte* data, int length)
  */
 virtual void passDown(byte* data, int length);

 /*
  * Is invoked by the processData() function and passes the data from the NetworkSocket to the 
  * synchronizeable object
  * This function is an implementation of the virtual int DataStream::passUp(byte* data) function
  *
  * 1. get the data from the NetworkSocket object by calling: NetworkSocket::readBytes(byte* data)
  * 2. save the data locally
  * 3. pass the data to the Synchronizeable object calling the 
  *                    Synchronizeable::writeBytes(byte* data, int length);
  */
 virtual int passUp(byte* data);