Index: /code/branches/network/src/network/ClientConnection.cc
===================================================================
--- /code/branches/network/src/network/ClientConnection.cc	(revision 1087)
+++ /code/branches/network/src/network/ClientConnection.cc	(revision 1088)
@@ -85,5 +85,5 @@
 
   ENetPacket *ClientConnection::getPacket() {
-    ENetAddress address;
+    ENetAddress address; //sems that address is not needed
     return getPacket(address);
   }
@@ -160,6 +160,6 @@
       case ENET_EVENT_TYPE_CONNECT:
       case ENET_EVENT_TYPE_RECEIVE:
-        COUT(5) << "Cl.Con: receiver-Thread: got new packet" << std::endl;
-        processData(&event);
+        COUT(5) << "Cl.Con: receiver-Thread while loop: got new packet" << std::endl;
+        if ( !processData(&event) ) COUT(2) << "Current packet was not pushed to packetBuffer -> ev ongoing SegFault" << std::endl;
         break;
       case ENET_EVENT_TYPE_DISCONNECT:
@@ -201,5 +201,5 @@
   bool ClientConnection::establishConnection() {
     ENetEvent event;
-    // connect to peer
+    // connect to peer (server is type ENetPeer*)
     server = enet_host_connect(client, &serverAddress, NETWORK_CLIENT_CHANNELS);
     if(server==NULL)
Index: /code/branches/network/src/network/GameStateClient.cc
===================================================================
--- /code/branches/network/src/network/GameStateClient.cc	(revision 1087)
+++ /code/branches/network/src/network/GameStateClient.cc	(revision 1088)
@@ -182,5 +182,5 @@
 
   GameState *GameStateClient::decompress(GameStateCompressed *a) {
-    COUT(4) << "GameStateClient: uncompressing gamestate. id: " << a->id << ", baseid: " << a->base_id << ", normsize: " << a->normsize << ", compsize: " << a->compsize << std::endl;
+    //COUT(4) << "GameStateClient: uncompressing gamestate. id: " << a->id << ", baseid: " << a->base_id << ", normsize: " << a->normsize << ", compsize: " << a->compsize << std::endl;
     int normsize = a->normsize;
     int compsize = a->compsize;
Index: /code/branches/network/src/network/GameStateManager.cc
===================================================================
--- /code/branches/network/src/network/GameStateManager.cc	(revision 1087)
+++ /code/branches/network/src/network/GameStateManager.cc	(revision 1088)
@@ -259,15 +259,17 @@
 
   GameStateCompressed *GameStateManager::compress_(GameState *a) {
-    COUT(4) << "G.St.Man: compressing gamestate" << std::endl;
-    COUT(4) << "G.St.Man: a: id: " << a->id << " base_id: " << a->base_id << " size: " << a->size << " diffed: " << a->diffed << std::endl;
+    //COUT(4) << "G.St.Man: compressing gamestate" << std::endl;
+
+    //COUT(4) << "G.St.Man: a: id: " << a->id << " base_id: " << a->base_id << " size: " << a->size << " diffed: " << a->diffed << std::endl;
     int size = a->size;
+
     uLongf buffer = (uLongf)((a->size + 12)*1.01)+1;
-    COUT(4) << "size: " << size << ", buffer: " << buffer << std::endl;
+    //COUT(4) << "size: " << size << ", buffer: " << buffer << std::endl;
     unsigned char* dest = (unsigned char*)malloc( buffer );
-    COUT(4) << "dest: " << dest << std::endl;
+    //COUT(4) << "dest: " << dest << std::endl;
     int retval;
     //std::cout << "before ziped " << buffer << std::endl;
     retval = compress( dest, &buffer, a->data, (uLong)size );
-    COUT(4) << "bloablabla aft3er compress" << std::endl;
+    //COUT(4) << "bloablabla aft3er compress" << std::endl;
     //std::cout << "after ziped " << buffer << std::endl;
 
@@ -291,5 +293,5 @@
     compressedGamestate->diffed = a->diffed;
     compressedGamestate->base_id = a->base_id;
-    COUT(5) << "G.St.Man: saved compressed data in GameStateCompressed:" << std::endl;
+    //COUT(5) << "G.St.Man: saved compressed data in GameStateCompressed:" << std::endl;
     return compressedGamestate;
   }
Index: /code/branches/network/src/network/PacketBuffer.cc
===================================================================
--- /code/branches/network/src/network/PacketBuffer.cc	(revision 1087)
+++ /code/branches/network/src/network/PacketBuffer.cc	(revision 1088)
@@ -62,5 +62,5 @@
       // change this!!!!!!! 
       last->packet = ev->packet;
-      last->address = ev->peer->address;
+      //last->address = ev->peer->address;
     } else {
       //insert a new element at the bottom
@@ -71,9 +71,13 @@
       // save the packet to the new element
       last->packet = ev->packet;
-      last->address = ev->peer->address;
+      //last->address = ev->peer->address;
     }
-    return true;
+    // pseudo bugfix: added a return false statement for error handling
+    if ( last->packet == ev->packet ) return true;
+    return false;
   }
 
+  //returns the first element in the list without deleting it but
+  //moving first pointer to next element
   ENetPacket *PacketBuffer::pop() {
     boost::mutex::scoped_lock lock(networkPacketBufferMutex);
Index: /code/branches/network/src/network/PacketDecoder.cc
===================================================================
--- /code/branches/network/src/network/PacketDecoder.cc	(revision 1087)
+++ /code/branches/network/src/network/PacketDecoder.cc	(revision 1088)
@@ -217,4 +217,6 @@
   void PacketDecoder::processGamestate( GameStateCompressed *state )
   {
+    COUT(5) << "PacketDecoder: processing Gamestate" << std::endl;
+    //printGamestate( state );
   }
 
Index: /code/branches/network/src/network/Synchronisable.cc
===================================================================
--- /code/branches/network/src/network/Synchronisable.cc	(revision 1087)
+++ /code/branches/network/src/network/Synchronisable.cc	(revision 1088)
@@ -46,9 +46,9 @@
     temp->var = var;
     temp->type = t;
-    COUT(5) << "registering var with size: " << temp->size << " and type: " << temp->type << std::endl; 
+    COUT(5) << "Syncronisable::registering var with size: " << temp->size << " and type: " << temp->type << std::endl; 
     // increase datasize
     datasize+=sizeof(int)+size;
     //std::cout << "push temp to syncList (at the bottom) " << datasize << std::endl;
-    COUT(5) << "objectID: " << objectID << " this: " << this << " name: " << this->getIdentifier()->getName() << " networkID: " << this->getIdentifier()->getNetworkID() << std::endl;
+    COUT(5) << "Syncronisable::objectID: " << objectID << " this: " << this << " name: " << this->getIdentifier()->getName() << " networkID: " << this->getIdentifier()->getNetworkID() << std::endl;
     syncList->push_back(temp);
   }
Index: /code/branches/network/src/network/diffTest.cc
===================================================================
--- /code/branches/network/src/network/diffTest.cc	(revision 1087)
+++ /code/branches/network/src/network/diffTest.cc	(revision 1088)
@@ -38,5 +38,5 @@
   if ( g1->id != g2->id ) {
     std::cout << "\t--> GameStates are not comparable -> not same id" << std::endl;
-    return 1;
+    return true;
   }
   else if ( g1->size != g2->size ) {
@@ -51,5 +51,16 @@
     }
   }
-  std::cout << "\t--> GameStates are identical (compareData)" << std::endl;
+  //std::cout << "\t--> GameData are identical (compareData)" << std::endl;
+  return true;
+}
+
+bool compareData2( GameState* g1, GameState* g2 ) {
+  int length = g1->size;
+  for ( int i=0; i<length; i++ ) {
+    if ( g1->data[i] != g2->data[i] ) {
+      return false;
+    }
+  }
+  //std::cout << "\t--> GameData are identical (compareData)" << std::endl;
   return true;
 }
@@ -67,9 +78,9 @@
     return false;
   }
-  else if ( !compareData( g1, g2 ) ) {
+  else if ( !compareData2( g1, g2 ) ) {
     std::cout << "\t==> GameState data are not identical (GameStateCompare)" << std::endl;
     return false;
   }
-  std::cout << "\t==> GameStates are identical (GameStateCompare)" << std::endl;
+  //std::cout << "\t==> GameStates are identical (GameStateCompare)" << std::endl;
   return true;
 }
@@ -132,5 +143,5 @@
     b->size = length;
     for ( int i=0; i<length; i++ ) {
-      if ( i%(rand()%((length)/11)) == 0 ) b->data[i] = rand()%255;
+      if ( i%(rand()%((length)/11)+rand()) == 0 ) b->data[i] = (char)rand()%255;
       else b->data[i] = a->data[i];
     }
@@ -141,9 +152,9 @@
     b->size = s;
     for ( int i=0; i<length; i++ ) {
-      if ( i%10 == 0 ) b->data[i] = rand()%255;
+      if ( i%10 == 0 ) b->data[i] = (char)rand()%255;
       else b->data[i] = a->data[i];
     }
     for( int i=length; i<s; i++ ) {
-      b->data[i] = rand()%255;
+      b->data[i] = (char)rand()%255;
     }
   }
@@ -153,5 +164,5 @@
     b->size = s;
     for ( int i=0; i<length; i++ ) {
-      if ( i%(rand()%(length)) == 0 ) b->data[i] = rand()%255;
+      if ( i%(rand()%(length)+rand()) == 0 ) b->data[i] = (char)rand()%255;
       else b->data[i] = a->data[i];
     }
@@ -165,5 +176,5 @@
     b->size = s;
     for ( int i=0; i<s; i++ ) {
-      if ( i%10 == 0 ) b->data[i] = rand()%255;
+      if ( i%10 == 0 ) b->data[i] = (char)rand()%255;
       else b->data[i] = a->data[i];
     }
@@ -260,5 +271,5 @@
   printGameState( g_undiff2 );  
 
-  if( !compareData( g_undiff1, g_undiff2 ) ) std::cout << " BUT THAT'S HOW IT HAS TO BE" << std::endl;
+  if( !compareData( g_undiff1, g_undiff2 ) ) std::cout << " DATA not identical.. ok" << std::endl;
 
   g_diffed = g_manager->testDiff( g_undiff1, g_undiff2 );
@@ -279,11 +290,110 @@
 
   std::cout << "---Diffed Gamestates before compressed and after uncompress comparsion" << std::endl;
-  compareGameStates( g_resultDiffed, g_diffed );
+  if ( compareGameStates( g_resultDiffed, g_diffed ) ) std::cout << "GAMESTATES IDENTICAL" << std::endl;
  
   g_resultUndiffed = g_client->testUndiff( g_undiff1, g_resultDiffed );
   std::cout << "---New Gamestate of pseudo Server compared with new gamestate that Client gets" << std::endl;
-  compareGameStates( g_resultUndiffed, g_undiff2 );
+  if ( compareGameStates( g_resultUndiffed, g_undiff2 ) ) std::cout << "GAMESTATES IDENTICAL" << std::endl;
 
   return;  
+}
+
+bool testNCompressWithDiff( int n, int size, int modeCreateData, int modeChangeData ) { 
+
+  GameStateClient* g_client;
+  GameStateManager* g_manager;;
+  
+  GameStateCompressed* gc = new GameStateCompressed;
+  GameState* g_undiff1 = new GameState;
+  GameState* g_undiff2 = new GameState;
+  GameState* g_diffed;
+  GameState* g_resultDiffed;
+  GameState* g_resultUndiffed;
+
+  g_undiff1->data = createData( size, modeCreateData );
+  g_undiff1->size = size;
+  g_undiff1->id = 1;
+  g_undiff1->diffed = false;
+  //l = -1;
+  g_undiff2 = changeGameStateABit( g_undiff1, modeChangeData );
+
+  while( compareData2( g_undiff1, g_undiff2 ) ) {
+    delete g_undiff2->data;
+    g_undiff2 = changeGameStateABit( g_undiff1, modeChangeData );
+  } 
+  //l = -2;
+  g_diffed = g_manager->testDiff( g_undiff1, g_undiff2 );
+  gc = g_manager->testCompress( g_diffed );
+  g_resultDiffed = g_client->testDecompress( gc );
+
+  if ( !compareGameStates( g_resultDiffed, g_diffed ) ) return false;
+  //l = -3;
+  g_resultUndiffed = g_client->testUndiff( g_undiff1, g_resultDiffed );
+  if ( !compareGameStates( g_resultUndiffed, g_undiff2 ) ) return false;
+  //l = 1;
+  /*if ( gc != NULL && gc->data != NULL )
+    delete gc->data;
+  //l = 2;
+  //if ( gc != NULL ) 
+    //delete gc;
+  //l = 3;
+  if ( g_undiff1 != NULL && g_undiff1->data != NULL )
+    delete g_undiff1->data;
+  //l = 4; 
+  //if ( g_undiff1 != NULL )
+   //delete g_undiff1;
+  //l = 5;
+  if ( g_undiff2 != NULL && g_undiff2->data )
+    delete g_undiff2->data;
+  //l = 6; 
+  //if ( g_undiff2 != NULL )
+    //delete g_undiff2;
+  //l = 7;
+  if ( g_diffed != NULL && g_diffed->data )
+    //delete g_diffed->data;
+  //l = 8; 
+  //if ( g_diffed )
+    //delete g_diffed;
+  //l = 9;
+  if ( g_resultDiffed != NULL && g_resultDiffed->data )
+    delete g_resultDiffed->data;
+  //l = 10; 
+  //if ( g_resultDiffed )
+    //delete g_resultDiffed;
+  //l = 11;*/
+  
+  return true;
+}
+
+bool testNCompression( int n, int size, int mode ) { 
+  GameStateClient* g_client;
+  GameStateManager* g_manager;;
+  
+  GameState* g_new = new GameState;
+  GameState* g_old = new GameState;
+  GameStateCompressed* gc = new GameStateCompressed;
+  
+  g_old->data = createData( size, mode );
+  g_old->size = size;
+  g_old->id = 0;
+  g_old->diffed = false;
+  
+  gc = g_manager->testCompress( g_old );
+
+  g_new = g_client->testDecompress( gc );
+
+  if ( !compareGameStates( g_new, g_old ) ) return false;
+  
+  
+  if ( g_new != NULL && g_new->data != NULL )
+    delete g_new->data;
+
+  if ( g_old != NULL && g_old->data != NULL )
+    delete g_old->data;
+
+  if ( gc != NULL && gc->data )
+    delete gc->data;
+
+  return true;
 }
 
@@ -521,5 +631,5 @@
 
 int main( int argc, char* argv[] ) {
-  int a,b,c;
+  int a,b,c,n;
   std::string dec = "nothing";
   std::cout << "############### START TEST (quit q) ###############" << std::endl;
@@ -527,6 +637,8 @@
   std::cout << "displayModes:\t\t modes" << std::endl;
   std::cout << "testCompression:\t tc [datalength] [mode Data]" << std::endl;
+  std::cout << "testNCompression:\t tnc [#of loops] [datalength] [mode Data]" << std::endl;
   std::cout << "testDifferentiation:\t td [datalength] [mode Data] [mode Change]" << std::endl;
   std::cout << "testCompressWithDiff:\t tcd [datalength] [mode Data] [mode Change]" << std::endl;
+  std::cout << "testNCompressWithDiff:\t tncd [#of loops] [datalength] [mode Data] [mode Change]" << std::endl;
   std::cout << "testClientObjectMapping: tcom [#clients]" << std::endl;
   std::cout << "testClientInformation:\t tci [#clients] (call with >10)" << std::endl;
@@ -558,5 +670,30 @@
     else if ( dec.compare("tbuf") == 0 ) {
       testPacketBuffer();
-    }   
+    } 
+    else if ( dec.compare("tncd") == 0 ) {
+      std::cin >> n; std::cin >> a; std::cin >> b; std::cin >> c;
+      for ( int i=1; i<=n; i++ ) {  
+        std::cout << i << " s" << a << " ";      
+        //std::cout << "start loop test " << i << std::endl;
+        if ( !testNCompressWithDiff( i, a, b, c ) ) {
+          std::cout << "#COMPARSION ERROR->VERYVERY BAD" << std::endl;
+          break;
+        }
+      }
+      std::cout << "end loop comparsion test" << std::endl;
+    }
+    else if ( dec.compare("tnc") == 0 ) {
+      std::cin >> n; std::cin >> a; std::cin >> b;
+      for ( int i=1; i<=n; i++ ) {  
+        std::cout << i << " s" << a << " ";      
+        //std::cout << "start loop test " << i << std::endl;
+        if ( !testNCompression( i, a, b ) ) {
+          std::cout << "#COMPARSION ERROR->VERYVERY BAD" << std::endl;
+          break;
+        }
+      }
+      std::cout << "end loop comparsion test" << std::endl;
+    }
+    else std::cout << "invalid input" << std::endl;  
     std::cout << "################## END ONE TURN ##################@" << std::endl;
   }
Index: /code/branches/network/src/orxonox/Orxonox.cc
===================================================================
--- /code/branches/network/src/orxonox/Orxonox.cc	(revision 1087)
+++ /code/branches/network/src/orxonox/Orxonox.cc	(revision 1088)
@@ -262,5 +262,6 @@
     hudOverlay->show();
     
-    client_g->establishConnection();
+    if( !client_g->establishConnection() )
+      COUT(1) <<"CLIENT COULD NOT ESTABLISH CONNECTION" << std::endl;
     client_g->tick(0);
     
Index: /code/branches/network/src/orxonox/objects/Model.cc
===================================================================
--- /code/branches/network/src/orxonox/objects/Model.cc	(revision 1087)
+++ /code/branches/network/src/orxonox/objects/Model.cc	(revision 1088)
@@ -89,5 +89,5 @@
         this->mesh_.setMesh(meshSrc_);
         this->attachObject(this->mesh_.getEntity());
-        COUT(4) << "Loader: Created model" << std::endl;
+        COUT(4) << "Loader (Model.cc): Created model" << std::endl;
       }
       return true;
@@ -96,5 +96,5 @@
     void Model::registerAllVariables(){
 //       WorldEntity::registerAllVariables();
-      COUT(5) << "registering new meshsrc with size: " << meshSrc_.length()+1 << std::endl;
+      COUT(5) << "Model.cc:registering new meshsrc with size: " << meshSrc_.length()+1 << " this: " << this << std::endl;
       registerVar(&meshSrc_, meshSrc_.length() + 1, network::STRING);
     }
