Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5741 in orxonox.OLD


Ignore:
Timestamp:
Nov 23, 2005, 4:15:09 PM (18 years ago)
Author:
bottac
Message:
 
Location:
branches/network/src/lib/network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/network_stream.cc

    r5738 r5741  
    1919*/
    2020#define DEBUG_MODULE_NETWORK
    21 #define PACKAGE_SIZE  8
     21#define PACKAGE_SIZE  256
    2222
    2323#include "base_object.h"
     
    4343  /* initialize the references */
    4444  this->networkSocket = new NetworkSocket();
     45  this->networkProtocol = new NetworkProtocol();
    4546  this->synchronizeables = NULL;
    4647  this->connectionMonitor = new ConnectionMonitor();
     
    5455  this->networkSocket = new NetworkSocket( address, 88 );
    5556   // this->networkSocket->connectToServer(address, 88);
    56 
     57  this->networkProtocol = new NetworkProtocol();
    5758  this->synchronizeables = &sync;
     59  this->connectionMonitor = new ConnectionMonitor();
    5860}
    5961
     
    6466  this->init();
    6567  this->networkSocket = new NetworkSocket(/* address, type */);
    66  
     68  this->networkProtocol = new NetworkProtocol();
    6769  this->synchronizeables = &sync;
     70  this->connectionMonitor = new ConnectionMonitor();
    6871}
    6972
     
    9194 
    9295  int ret = 0;
     96
     97  /* DOWNSTREAM */
     98
     99  /* first of all read the synchronizeable's data: */
     100  ret = this->synchronizeables->readBytes((byte*)downBuffer);
    93101 
    94  
    95  
    96   /* DOWNSTREAM */
    97   /* first of all read the synchronizeable's data: */
     102  /* send the received data to connectionMonitor */
     103  this->connectionMonitor->processPacket((byte*)downBuffer, PACKAGE_SIZE);
    98104
    99   ret = this->synchronizeables->readBytes((byte*)downBuffer);
    100         this->connectionMonitor->processPacket((byte*)downBuffer, PACKAGE_SIZE);
    101         //this-> ->extractHeader(byte* data, int length);
     105        this->networkProtocol->createHeader((byte*) downBuffer , PACKAGE_SIZE, 1024,*(this->synchronizeables),12);
     106       
    102107  /* pass the data to the network socket */
    103108  ret = this->networkSocket->writeBytes((byte*)downBuffer, PACKAGE_SIZE);
     
    105110  if( ret == -1) { PRINTF(0)("Error in writing data to the NetworkSocket\n");}
    106111 
     112
     113
     114  /* UPSTREAM */
    107115 
    108   /* UPSTREAM */
    109   /* first read 10bytes of data (debug) */
     116  ret = 0;
    110117
    111   ret = 0;
    112118  while(ret == 0)  ret = this->networkSocket->readBlock((byte*)upBuffer,PACKAGE_SIZE);
    113119  /* error checking: data read? */
    114120  if( ret != PACKAGE_SIZE) { PRINTF(0)("Error while reading data from the NetworkSocket\n");}
     121
     122  /* send the received data to connectionMonitor */
     123  this->connectionMonitor->processPacket((byte*)upBuffer, PACKAGE_SIZE);
     124
     125  /* extract Header */
     126  this->networkProtocol->extractHeader((byte*) upBuffer , PACKAGE_SIZE);
     127   
    115128  /* now pass the data to the sync object */
    116 
    117   this->synchronizeables->writeBytes((byte*)upBuffer, PACKAGE_SIZE);
    118 
    119  
    120  
     129  this->synchronizeables->writeBytes((byte*)upBuffer[sizeof(Header)], PACKAGE_SIZE);
    121130
    122131}
    123 
  • branches/network/src/lib/network/network_stream.h

    r5728 r5741  
    1212class NetworkSocket;
    1313class ConnectionMonitor;
     14class NetworkProtocol;
    1415
    1516class NetworkStream : public DataStream
     
    2829
    2930private:
    30   //NetworkProtocol* networkProtocol;
    31   //NetworkSocket*        networkSockets;
    32   ConnectionMonitor*      connectionMonitor;
    33  // tList<Synchronizeable>* synchronizeables;
    34   Synchronizeable*          synchronizeables;
    35   NetworkSocket* networkSocket;
     31   NetworkProtocol* networkProtocol;
     32   //NetworkSocket*       networkSockets;
     33   ConnectionMonitor*      connectionMonitor;
     34   // tList<Synchronizeable>* synchronizeables;
     35   Synchronizeable*         synchronizeables;
     36   NetworkSocket* networkSocket;
    3637};
    3738#endif /* _NETWORK_STREAM */
Note: See TracChangeset for help on using the changeset viewer.