= !NetworkStream = Next steps: * Object creation and destruciton: 1. The !NetworkStream creates a [wiki:archive/NetworkSocket NetworkSocket] in its constructor 1. The !NetworkStream deletes and uninitializes the [wiki:archive/NetworkSocket NetworkSocket] in its constructor * processData() function: upstream 1. it first gets the data from the underlaying [wiki:archive/NetworkSocket NetworkSocket]. 1. pass the data to the [wiki:archive/ConnectionMonitor ConnectionMonitor]::processData(); 1. pass the data to the [wiki:archive/NetworkProtocol NetworkProtocol]::removeHeader(); 1. pass the data to the [wiki:archive/Synchronizeable Synchronizeable] object * processData() function: downstream 1. get the data from the [wiki:archive/Synchronizeable Synchronizeable] object 1. pass the data to the [wiki:archive/ConnectionMonitor ConnectionMonitor]::processData(); 1. pass the data to the [wiki:archive/NetworkProtocol NetworkProtocol]::removeHeader(); 1. pass the data to the [wiki:archive/NetworkSocket NetworkSocket] object * test your work always with the src/subprojects/network/ application [[br]] [[br]] {{{ /* 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 informations. * * @param address: the address informations (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); }}}