Index: /branches/network/src/lib/network/connection_monitor.cc
===================================================================
--- /branches/network/src/lib/network/connection_monitor.cc	(revision 5799)
+++ /branches/network/src/lib/network/connection_monitor.cc	(revision 5800)
@@ -88,5 +88,7 @@
   /*Update the lifetime Variables*/
   totalReceivedPackets ++;
-  averageDatarate = totalReceivedPackets/(currentPacketTick - startTime);
+  float timeDiff = this->currentPacketTick - this->startTime;
+  if( timeDiff != 0.0f )
+    averageDatarate = totalReceivedPackets/timeDiff;
 
   /*Preparefor the next Packet*/
@@ -134,10 +136,10 @@
 //   PRINT(0)("Total lost packets:",totalLostPackets);
 //   PRINT(0)("Packetloss [%] :\n",totalPacketloss);
-// 
+//
 //   PRINT(0)("Current datarate :\n",currentDatarate);
 //   PRINT(0)("Delays of the last few packets :\n");
 //   for(int i=1 ;i <= packetToAverage-1;i++)
 //     PRINT(0)("%i ",lastFewDelays[i]);
-// 
+//
 //   PRINT(0)("============================================\n");
 
Index: /branches/network/src/lib/network/network_stream.cc
===================================================================
--- /branches/network/src/lib/network/network_stream.cc	(revision 5799)
+++ /branches/network/src/lib/network/network_stream.cc	(revision 5800)
@@ -11,5 +11,5 @@
 ### File Specific:
    main-programmer: claudio
-   co-programmer: 
+   co-programmer:
 */
 
@@ -39,5 +39,5 @@
 
 
-NetworkStream::NetworkStream() 
+NetworkStream::NetworkStream()
   : DataStream()
 {
@@ -51,5 +51,5 @@
 
 
-NetworkStream::NetworkStream(IPaddress& address, Synchronizeable& sync, NodeType type) 
+NetworkStream::NetworkStream(IPaddress& address, Synchronizeable& sync, NodeType type)
   : DataStream()
 {
@@ -63,5 +63,5 @@
 
 
-NetworkStream::NetworkStream(Synchronizeable& sync, int port, NodeType type) 
+NetworkStream::NetworkStream(Synchronizeable& sync, int port, NodeType type)
   : DataStream()
 {
@@ -95,12 +95,14 @@
 {
 
- 
+
   int ret = 0;
 
   /* DOWNSTREAM */
 
+  PRINT(0)("\n\n");
+  PRINT(0)("============= DOWNSTREAM:===============\n");
   /* first of all read the synchronizeable's data: */
   ret = this->synchronizeables->readBytes((byte*)downBuffer);
-  
+
   /* send the received data to connectionMonitor */
   this->connectionMonitor->processPacket((byte*)downBuffer, ret + sizeof(Header));
@@ -108,16 +110,16 @@
   this->networkProtocol->createHeader((byte*)downBuffer, ret, DATA_STREAM_BUFFER_SIZE,
                                        *(this->synchronizeables), 12);
-	
+
   /* pass the data to the network socket */
   ret = this->networkSocket->writeBytes((byte*)downBuffer, PACKAGE_SIZE + sizeof(Header));
   /* check if there was an error */
   if( ret == -1) { PRINTF(0)("Error in writing data to the NetworkSocket\n");}
-  
+
 
 
   /* UPSTREAM */
-  
-  ret = 0; 
 
+  ret = 0;
+  PRINT(0)("============== UPSTREAM:================\n");
   /* first of all read  data from networkSocket*/
   ret = this->networkSocket->readBlock((byte*)upBuffer, PACKAGE_SIZE + sizeof(Header));
@@ -130,7 +132,7 @@
   /* extract Header */
   this->networkProtocol->extractHeader((byte*) upBuffer , PACKAGE_SIZE + sizeof(Header));
-    
+
   /* now pass the data to the sync object */
-  this->synchronizeables->writeBytes((byte*)upBuffer, PACKAGE_SIZE);
+  this->synchronizeables->writeBytes((byte*)upBuffer, ret);
 
 }
Index: /branches/network/src/subprojects/network/network_unit_test.cc
===================================================================
--- /branches/network/src/subprojects/network/network_unit_test.cc	(revision 5799)
+++ /branches/network/src/subprojects/network/network_unit_test.cc	(revision 5800)
@@ -144,11 +144,11 @@
 
   /* synchronize the data 1 time (increment for longer tests) */
-  for( int i = 0; i < 3; i++) {
+  for( int i = 0; i < 2; i++) {
     nm->synchronize();
   }
 
   printf("Test finished\n");
-  
-  
+
+
   /* delete the network manager again */
   delete nm;
Index: /branches/network/src/subprojects/network/simple_sync.cc
===================================================================
--- /branches/network/src/subprojects/network/simple_sync.cc	(revision 5799)
+++ /branches/network/src/subprojects/network/simple_sync.cc	(revision 5800)
@@ -1,15 +1,15 @@
 /*
   orxonox - the future of 3D-vertical-scrollers
- 
+
   Copyright (C) 2004 orx
- 
+
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
       the Free Software Foundation; either version 2, or (at your option)
       any later version.
- 
+
 ### File Specific:
     main-programmer: Patrick Boenzli
-    co-programmer: 
+    co-programmer:
 */
 
@@ -24,4 +24,5 @@
 #include "debug.h"
 
+
 /**
  *  default constructor
@@ -31,13 +32,20 @@
 {
   this->outLength = 10;
+  this->recLength = 0;
   this->inLength = 40;
   this->outData = new byte[this->outLength];
   this->inData = new byte[this->inLength];
-  
+
   for( int i = 0; i < this->outLength; i++)
   {
     this->outData[i] = i;
   }
+  for( int i = 0; i < this->inLength; i++)
+  {
+    this->inData[i] = 0;
+  }
+
 }
+
 
 /**
@@ -48,4 +56,5 @@
 }
 
+
 /**
  *  write data to Synchronizeable
@@ -53,8 +62,10 @@
 void SimpleSync::writeBytes(byte* data, int length)
 {
+  PRINTF(0)("SimpleSync: got %i bytes of data\n", length);
+  this->recLength = length;
   if(this->inLength < length)
     PRINTF(0)("ERROR: local buffer is smaller than the data to receive.\n");
   /* copy the data localy */
-  for( int i = 0; i < this->inLength; i++)
+  for( int i = 0; i < length; i++)
   {
     this->inData[i] = data[i];
@@ -70,4 +81,5 @@
 int SimpleSync::readBytes(byte* data)
 {
+  PRINTF(0)("SimpleSync: sent %i bytes of data\n", this->outLength);
   /* write the test message */
   data = this->outData;
@@ -78,8 +90,9 @@
 }
 
+
 void SimpleSync::writeDebug()
 {
   PRINTF(0)("Write in: |");
-  for(int i = 0; i < this->inLength; i++)
+  for(int i = 0; i < this->recLength; i++)
   {
     PRINT(0)(" %i ",this->inData[i]);
@@ -88,4 +101,5 @@
 }
 
+
 void SimpleSync::readDebug()
 {
@@ -93,5 +107,5 @@
   for(int i = 0; i < this->outLength; i++)
   {
-    PRINT(0)(" %i ",this->outData[i]);
+    PRINT(0)(" %c ",this->outData[i]);
   }
   PRINT(0)("|\n");
Index: /branches/network/src/subprojects/network/simple_sync.h
===================================================================
--- /branches/network/src/subprojects/network/simple_sync.h	(revision 5799)
+++ /branches/network/src/subprojects/network/simple_sync.h	(revision 5800)
@@ -15,16 +15,17 @@
     SimpleSync();
     ~SimpleSync();
-  
+
     virtual void writeBytes(byte* data, int length);
     virtual int readBytes(byte* data);
-    
+
   private:
     virtual void writeDebug();
     virtual void readDebug();
 
-    
+
   private:
     byte* inData;
     int   inLength;
+    int   recLength;
     byte* outData;
     int   outLength;
