Index: branches/network/src/lib/network/network_protocol.cc
===================================================================
--- branches/network/src/lib/network/network_protocol.cc	(revision 5801)
+++ branches/network/src/lib/network/network_protocol.cc	(revision 5802)
@@ -8,5 +8,5 @@
    the Free Software Foundation; either version 2, or (at your option)
    any later version.
-   
+
    ### File Specific:
    main-programmer: Benjamin Wuest
@@ -63,16 +63,16 @@
 int NetworkProtocol::createHeader(byte* data, int length, int bufferLength, const Synchronizeable& source, unsigned int remoteID)
 {
-  PRINTF(0)("create header\n");
-  printf("length = %i, bufferLength = %i\n", length, bufferLength);
+  printf("NetworkProtocol: create header length = %i, bufferLength = %i\n", length, bufferLength);
   //If there isn't enough space for the header return -1
   if (length + headerLength > bufferLength)
     return -1;
-  
+
   //Create space for the header
   for( int i = length - 1; i >= 0; i--)
     data[i + headerLength] = data[i];
-  
+
   //Include header
   data[0] = 255;
+  return length + headerLength;
 }
 
@@ -94,16 +94,16 @@
     return h;
   }
-  
+
   //Extract header
   Header h;
   h.protocol = data[0];
-  
+
   h.length = length - headerLength;
   h.data = data;
-  
+
   //Remove header
   for (int i = headerLength; i < length; i++)
     data[i - headerLength] = data[i];
-  
+
   return h;
 }
Index: branches/network/src/lib/network/network_stream.cc
===================================================================
--- branches/network/src/lib/network/network_stream.cc	(revision 5801)
+++ branches/network/src/lib/network/network_stream.cc	(revision 5802)
@@ -106,12 +106,14 @@
 
   /* send the received data to connectionMonitor */
-  this->connectionMonitor->processPacket((byte*)downBuffer, ret + sizeof(Header));
+  this->connectionMonitor->processPacket((byte*)downBuffer, ret);
 
-  this->networkProtocol->createHeader((byte*)downBuffer, ret, DATA_STREAM_BUFFER_SIZE,
-                                       *(this->synchronizeables), 12);
+  ret = this->networkProtocol->createHeader((byte*)downBuffer, ret, DATA_STREAM_BUFFER_SIZE,
+                                            *(this->synchronizeables), 12);
 
+  printf("created header: data packet wights: %i bytes\n", ret);
   /* pass the data to the network socket */
-  ret = this->networkSocket->writeBytes((byte*)downBuffer, PACKAGE_SIZE + sizeof(Header));
+  ret = this->networkSocket->writeBytes((byte*)downBuffer, ret);
   /* check if there was an error */
+  printf("NetworkSocket: sent %i bytes\n", ret);
   if( ret == -1) { PRINTF(0)("Error in writing data to the NetworkSocket\n");}
 
@@ -123,16 +125,19 @@
   PRINT(0)("============== UPSTREAM:================\n");
   /* first of all read  data from networkSocket*/
-  ret = this->networkSocket->readBlock((byte*)upBuffer, PACKAGE_SIZE + sizeof(Header));
+  ret = this->networkSocket->readBlock((byte*)upBuffer, 11/* this is very bad: hard coded packet sizes! */);
   /* error checking: data read? */
-  if( ret != PACKAGE_SIZE + sizeof(Header)) { PRINTF(0)("Error while reading data from the NetworkSocket\n");}
+  printf("NetworkSocket: received %i bytes\n", ret);
+  if( ret != PACKAGE_SIZE + sizeof(Header)) { PRINTF(0)("Error while reading data from the NetworkSocket. Skipping further work\n");}
+  else
+  {
+    /* send the received data to connectionMonitor */
+    this->connectionMonitor->processPacket((byte*)upBuffer, ret);
 
-  /* send the received data to connectionMonitor */
-  this->connectionMonitor->processPacket((byte*)upBuffer, PACKAGE_SIZE + sizeof(Header));
+    /* extract Header */
+    this->networkProtocol->extractHeader((byte*) upBuffer , ret);
 
-  /* extract Header */
-  this->networkProtocol->extractHeader((byte*) upBuffer , PACKAGE_SIZE + sizeof(Header));
-
-  /* now pass the data to the sync object */
-  this->synchronizeables->writeBytes((byte*)upBuffer, ret);
+    /* now pass the data to the sync object */
+    this->synchronizeables->writeBytes((byte*)upBuffer, ret);
+  }
 
 }
Index: branches/network/src/subprojects/network/simple_sync.cc
===================================================================
--- branches/network/src/subprojects/network/simple_sync.cc	(revision 5801)
+++ branches/network/src/subprojects/network/simple_sync.cc	(revision 5802)
@@ -96,5 +96,5 @@
   for(int i = 0; i < this->recLength; i++)
   {
-    PRINT(0)(" %i ",this->inData[i]);
+    PRINT(0)(" [%u] ",this->inData[i]);
   }
   PRINT(0)("|\n");
@@ -104,8 +104,8 @@
 void SimpleSync::readDebug()
 {
-  PRINTF(0)("Read out: |");
+  PRINTF(0)("Read out bytes: |");
   for(int i = 0; i < this->outLength; i++)
   {
-    PRINT(0)(" %c ",this->outData[i]);
+    PRINT(0)(" [%u] ",this->outData[i]);
   }
   PRINT(0)("|\n");
