Index: branches/network/src/defs/debug.h
===================================================================
--- branches/network/src/defs/debug.h	(revision 5802)
+++ branches/network/src/defs/debug.h	(revision 5804)
@@ -62,5 +62,5 @@
   #define DEBUG_MODULE_ORXONOX               2
   #define DEBUG_MODULE_WORLD                 2
-  #define DEBUG_MODULE_NETWORK               2
+  #define DEBUG_MODULE_NETWORK               4
 
   // LOADING
Index: branches/network/src/lib/network/network_manager.cc
===================================================================
--- branches/network/src/lib/network/network_manager.cc	(revision 5802)
+++ branches/network/src/lib/network/network_manager.cc	(revision 5804)
@@ -76,9 +76,9 @@
   /* set the class id for the base object */
   this->setClassID(CL_NETWORK_MANAGER, "NetworkManager");
-  
+
   /* initialize the references */
   this->netStreamList = NULL;
   this->syncList = NULL;
-  
+
   PRINTF(0)("NetworkManager created\n");
 }
@@ -128,5 +128,5 @@
 NetworkStream& NetworkManager::establishConnection(IPaddress& address, Synchronizeable& sync)
 {
-  PRINTF(0)("Establish connection...\n");
+  printf("Establish connection to server %s, on port %u\n", SDLNet_ResolveIP(&address), address.port);
   /* creating a new network stream, it will register itself automaticaly to the class list */
   NetworkStream* netStream = new NetworkStream(address, sync, NET_CLIENT);
@@ -137,7 +137,7 @@
  * @param sync: the listener
  */
-NetworkStream& NetworkManager::createServer(Synchronizeable& sync, int port)
+NetworkStream& NetworkManager::createServer(Synchronizeable& sync, unsigned int port)
 {
-  PRINTF(0)("Create a new server socket...\n");
+  printf("Create a new server socket, liestening on port %u...\n", port);
   /* creating a new network stream, it will register itself automaticaly to the class list */
   NetworkStream* netStream = new NetworkStream(sync, port, NET_SERVER);
@@ -160,5 +160,4 @@
 void NetworkManager::synchronize()
 {
-  PRINTF(0)("NetworkManager synchronizes\n");
   if (this->netStreamList != NULL || (this->netStreamList = ClassList::getList(CL_NETWORK_STREAM)) != NULL)
   {
@@ -167,6 +166,4 @@
     while( stream)
     {
-      printf("NetworkManager::synchronize ");
-      if(stream->isServer()) printf("Server\n"); else printf("Client\n");
       stream->processData();
       stream = (NetworkStream*)(iterator->nextElement());
Index: branches/network/src/lib/network/network_manager.h
===================================================================
--- branches/network/src/lib/network/network_manager.h	(revision 5802)
+++ branches/network/src/lib/network/network_manager.h	(revision 5804)
@@ -32,10 +32,10 @@
   void initialize();
   void shutdown();
-  
+
   NetworkStream& establishConnection(IPaddress& address, Synchronizeable& sync);
   NetworkStream& establishConnection(const char& hostName, const Synchronizeable& sync);
-  NetworkStream& createServer(Synchronizeable& sync, int port);
+  NetworkStream& createServer(Synchronizeable& sync, unsigned int port);
   void shutdownConnection();
-  
+
   void synchronize();
 
@@ -43,5 +43,5 @@
   tList<BaseObject>*    netStreamList;            // list with refs to all network streams
   tList<BaseObject>*  syncList;                 // list of synchronizeables
-   
+
 };
 
Index: branches/network/src/lib/network/network_socket.cc
===================================================================
--- branches/network/src/lib/network/network_socket.cc	(revision 5802)
+++ branches/network/src/lib/network/network_socket.cc	(revision 5804)
@@ -63,8 +63,8 @@
  * Constructor to connect directly
  */
-NetworkSocket::NetworkSocket(IPaddress ip, unsigned int port)
+NetworkSocket::NetworkSocket(IPaddress ip)
 {
   NetworkSocket();
-  connectToServer(ip, port);
+  connectToServer(ip);
 }
 
@@ -90,7 +90,6 @@
  * It is called by the NetworkStream. It creates a TCP/UDP socket for the connection.
  * @param ip
- * @param port
- */
-void NetworkSocket::connectToServer(IPaddress ip, unsigned int port)
+ */
+void NetworkSocket::connectToServer(IPaddress ip)
 {
   //check if not already connected or listening
@@ -218,5 +217,5 @@
   memcpy(outgoingBuffer + outgoingBufferLength, data, nbytes);
   outgoingBufferLength += nbytes;
-  
+
   SDL_mutexV(outgoingBufferMutex);
 
@@ -287,4 +286,5 @@
 int NetworkSocket::readBlock(byte * data, int length)
 {
+  printf("NetworkSocket: got %i bytes, NetworkStream requested %i bytes\n", this->incomingBufferLength, length);
   if (incomingBufferLength >= length)
     return readBytes(data, length);
Index: branches/network/src/lib/network/network_socket.h
===================================================================
--- branches/network/src/lib/network/network_socket.h	(revision 5802)
+++ branches/network/src/lib/network/network_socket.h	(revision 5804)
@@ -73,8 +73,8 @@
 
   NetworkSocket();
-  NetworkSocket(IPaddress ip, unsigned int port);
+  NetworkSocket(IPaddress ip);
   ~NetworkSocket();
 
-  void connectToServer(IPaddress ip, unsigned int port);
+  void connectToServer(IPaddress ip);
   void listen(unsigned int port);
   void disconnectServer();
Index: branches/network/src/lib/network/network_stream.cc
===================================================================
--- branches/network/src/lib/network/network_stream.cc	(revision 5802)
+++ branches/network/src/lib/network/network_stream.cc	(revision 5804)
@@ -55,6 +55,5 @@
 {
   this->init();
-  this->networkSocket = new NetworkSocket( address, 9999 );
-   // this->networkSocket->connectToServer(address, 88);
+  this->networkSocket = new NetworkSocket(address);
   this->networkProtocol = new NetworkProtocol();
   this->synchronizeables = &sync;
@@ -63,10 +62,10 @@
 
 
-NetworkStream::NetworkStream(Synchronizeable& sync, int port, NodeType type)
+NetworkStream::NetworkStream(Synchronizeable& sync, unsigned int port, NodeType type)
   : DataStream()
 {
   this->init();
-  this->networkSocket = new NetworkSocket(/* address, type */);
-  this->networkSocket->listen(9999);
+  this->networkSocket = new NetworkSocket();
+  this->networkSocket->listen(port);
   this->networkProtocol = new NetworkProtocol();
   this->synchronizeables = &sync;
@@ -94,11 +93,8 @@
 void NetworkStream::processData()
 {
-
-
   int ret = 0;
 
   /* DOWNSTREAM */
-
-  PRINT(0)("\n\n");
+  printf("\nSynchronizeable: %s\n", this->synchronizeables->getName());
   PRINT(0)("============= DOWNSTREAM:===============\n");
   /* first of all read the synchronizeable's data: */
@@ -121,5 +117,4 @@
 
   /* UPSTREAM */
-
   ret = 0;
   PRINT(0)("============== UPSTREAM:================\n");
@@ -128,5 +123,5 @@
   /* error checking: data read? */
   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");}
+  if( ret != 11 /*PACKAGE_SIZE + sizeof(Header)*/) { PRINTF(0)("Error while reading data from the NetworkSocket. Skipping further work\n");}
   else
   {
@@ -135,8 +130,8 @@
 
     /* extract Header */
-    this->networkProtocol->extractHeader((byte*) upBuffer , ret);
+    Header header = this->networkProtocol->extractHeader((byte*) upBuffer , ret);
 
     /* now pass the data to the sync object */
-    this->synchronizeables->writeBytes((byte*)upBuffer, ret);
+    this->synchronizeables->writeBytes((byte*)upBuffer, header.length);
   }
 
Index: branches/network/src/lib/network/network_stream.h
===================================================================
--- branches/network/src/lib/network/network_stream.h	(revision 5802)
+++ branches/network/src/lib/network/network_stream.h	(revision 5804)
@@ -20,10 +20,10 @@
   NetworkStream();
   NetworkStream(IPaddress& address, Synchronizeable& sync, NodeType type);
-  NetworkStream(Synchronizeable& sync, int port, NodeType type);
-  
+  NetworkStream(Synchronizeable& sync, unsigned int port, NodeType type);
+
   ~NetworkStream();
-   
+
   void init();
-  
+
   inline bool isServer() { return (this->type == NET_SERVER)? true:false; }
   virtual void processData();
@@ -31,8 +31,8 @@
 private:
    NetworkProtocol* networkProtocol;
-   //NetworkSocket*	  networkSockets;
+   //NetworkSocket*       networkSockets;
    ConnectionMonitor*      connectionMonitor;
    // tList<Synchronizeable>* synchronizeables;
-   Synchronizeable* 	    synchronizeables;
+   Synchronizeable*         synchronizeables;
    NetworkSocket* networkSocket;
    int                    type;
Index: branches/network/src/lib/network/synchronizeable.cc
===================================================================
--- branches/network/src/lib/network/synchronizeable.cc	(revision 5802)
+++ branches/network/src/lib/network/synchronizeable.cc	(revision 5804)
@@ -21,8 +21,7 @@
                    \brief default constructor
  */
-Synchronizeable::Synchronizeable()
+Synchronizeable::Synchronizeable(const char* name)
 {
-
-
+  this->name = name;
 }
 
Index: branches/network/src/lib/network/synchronizeable.h
===================================================================
--- branches/network/src/lib/network/synchronizeable.h	(revision 5802)
+++ branches/network/src/lib/network/synchronizeable.h	(revision 5804)
@@ -11,21 +11,22 @@
 
 class Synchronizeable : virtual public BaseObject
-{
-        public:
+  {
+  public:
 
-                   Synchronizeable();
-                   ~Synchronizeable();
+    Synchronizeable(const char* name);
+    ~Synchronizeable();
 
- virtual void      writeBytes(byte* data, int length);
- virtual int       readBytes(byte* data);
- virtual void      writeDebug();
- virtual void      readDebug();
+    virtual void      writeBytes(byte* data, int length);
+    virtual int       readBytes(byte* data);
+    virtual void      writeDebug();
+    virtual void      readDebug();
 
+    inline const char* getName() { return this->name; }
 
-        private:
+  private:
 
- int               uniqueID;
+    int               uniqueID;
+    const char*       name;
 
-};
-
+  };
 #endif /* _SYNCHRONIZEABLE_H */
Index: branches/network/src/subprojects/network/network_unit_test.cc
===================================================================
--- branches/network/src/subprojects/network/network_unit_test.cc	(revision 5802)
+++ branches/network/src/subprojects/network/network_unit_test.cc	(revision 5804)
@@ -36,5 +36,5 @@
   SDL_Delay(20);
 
-  NetworkSocket client(ip, 9999);
+  NetworkSocket client(ip);
 
   char buf[1024];
@@ -123,11 +123,8 @@
   printf("=================\n");
 
-  IPaddress ip;
-  //SDLNet_ResolveHost(&ip, "127.0.0.1", 9999);
-  SDLNet_ResolveHost(&ip, "localhost", 9999);
-  Synchronizeable* clientSync = new SimpleSync();
-  Synchronizeable* serverSync = new SimpleSync();
+  Synchronizeable* clientSync = new SimpleSync("Client\0");
+  Synchronizeable* serverSync = new SimpleSync("Server\0");
 
-
+  unsigned int port = 9999;
 
   /* create the network manager */
@@ -138,7 +135,11 @@
 
   /* create a server stream */
-  nm->createServer(*serverSync, 9999);
+  nm->createServer(*serverSync, port);
 
   /* esatblish a connection */
+  IPaddress ip;
+  int error = SDLNet_ResolveHost(&ip, "127.0.0.1", port);
+  //SDLNet_ResolveHost(&ip, "localhost", port);
+  if(error == -1) printf("\n\nerror on address resolution, program inconsistancy\n\n");
   nm->establishConnection(ip, *clientSync);
 
Index: branches/network/src/subprojects/network/simple_sync.cc
===================================================================
--- branches/network/src/subprojects/network/simple_sync.cc	(revision 5802)
+++ branches/network/src/subprojects/network/simple_sync.cc	(revision 5804)
@@ -28,6 +28,6 @@
  *  default constructor
  */
-SimpleSync::SimpleSync()
-  : Synchronizeable()
+SimpleSync::SimpleSync(const char* name)
+  : Synchronizeable(name)
 {
   this->outLength = 10;
Index: branches/network/src/subprojects/network/simple_sync.h
===================================================================
--- branches/network/src/subprojects/network/simple_sync.h	(revision 5802)
+++ branches/network/src/subprojects/network/simple_sync.h	(revision 5804)
@@ -13,9 +13,10 @@
 {
   public:
-    SimpleSync();
+    SimpleSync(const char* name);
     ~SimpleSync();
 
     virtual void writeBytes(byte* data, int length);
     virtual int readBytes(byte* data);
+
 
   private:
