| Version 2 (modified by landauf, 18 years ago) (diff) |
|---|
NetworkStream
Next steps:
- Object creation and destruciton:
- The NetworkStream creates a NetworkSocket? in its constructor
- The NetworkStream deletes and uninitializes the NetworkSocket? in its constructor
- processData() function: upstream
- it first gets the data from the underlaying NetworkSocket?.
- pass the data to the ConnectionMonitor?::processData();
- pass the data to the NetworkProtocol?::removeHeader();
- pass the data to the Synchronizeable? object
- processData() function: downstream
- get the data from the Synchronizeable? object
- pass the data to the ConnectionMonitor?::processData();
- pass the data to the NetworkProtocol?::removeHeader();
- pass the data to the NetworkSocket? object
- test your work always with the src/subprojects/network/ application
/* 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);










