Index: /branches/network/src/lib/network/Makefile.am
===================================================================
--- /branches/network/src/lib/network/Makefile.am	(revision 7539)
+++ /branches/network/src/lib/network/Makefile.am	(revision 7540)
@@ -13,4 +13,8 @@
                       network_protocol.cc \
 		      server_socket.cc \
+		      tcp_server_socket.cc \
+		      tcp_socket.cc \
+		      udp_server_socket.cc \
+		      udp_socket.cc \
 		      handshake.cc \
 		      network_game_manager.cc \
@@ -38,4 +42,8 @@
                  network_protocol.h \
 		 server_socket.h \
+		 tcp_server_socket.h \
+		 tcp_socket.h \
+		 udp_server_socket.h \
+		 udp_socket.h \
 		 handshake.h \
 		 network_game_manager.h \
Index: /branches/network/src/lib/network/network_manager.cc
===================================================================
--- /branches/network/src/lib/network/network_manager.cc	(revision 7539)
+++ /branches/network/src/lib/network/network_manager.cc	(revision 7540)
@@ -90,12 +90,5 @@
 int NetworkManager::establishConnection(const std::string & name, unsigned int port)
 {
-  IPaddress ipAddress;
-  int error = SDLNet_ResolveHost(&ipAddress, name.c_str(), port);
-  if( error == -1) {
-    printf("\n\nerror on address resolution, program inconsistency\n\n");
-    return -1;
-  }
-
-  this->defaultSyncStream = new NetworkStream(ipAddress);
+  this->defaultSyncStream = new NetworkStream( name, port );
   this->sharedNetworkData->setDefaultSyncStream(this->defaultSyncStream);
   this->defaultSyncStream->startHandshake();
Index: /branches/network/src/lib/network/network_socket.cc
===================================================================
--- /branches/network/src/lib/network/network_socket.cc	(revision 7539)
+++ /branches/network/src/lib/network/network_socket.cc	(revision 7540)
@@ -21,6 +21,4 @@
 #define DEBUG_MODULE_NETWORK
 
-#include "converter.h"
-
 /* include your own header */
 #include "network_socket.h"
@@ -34,434 +32,13 @@
 NetworkSocket::NetworkSocket()
 {
-  this->init();
+  bOk = true;
 }
 
-/**
- * Constructor to connect directly
- */
-NetworkSocket::NetworkSocket(IPaddress ip)
+NetworkSocket::~ NetworkSocket( )
 {
-  this->init();
-  connectToServer(ip);
-}
-
-
-NetworkSocket::NetworkSocket( TCPsocket sock )
-{
-  this->init();
-  this->tcpSocket = sock;
-
-  readThread = SDL_CreateThread(thread_read, (void*)this);
-  writeThread = SDL_CreateThread(thread_write, (void*)this);
-}
-
-void NetworkSocket::init()
-{
-  /* set the class id for the base object */
-  this->setClassID(CL_NETWORK_SOCKET, "NetworkSocket");
-
-  tcpSocket = NULL;
-  incomingBufferLength = 0;
-  outgoingBufferLength = 0;
-
-  readThread = NULL;
-  writeThread = NULL;
-
-
-  thread_write_running = false;
-  thread_read_running = false;
-
-  incomingBufferMutex = SDL_CreateMutex();
-  outgoingBufferMutex = SDL_CreateMutex();
-
-
-  socketMutex = SDL_CreateMutex();
-  terminateThread = false;
-
-  /* Init SDL_net */
-  //NOTE: do we need to call SDLNet_Init for all instances?
-  if(SDLNet_Init()==-1)
-  {
-    PRINTF(1)("SDLNet_Init: %s\n", SDLNet_GetError());
-    return;
-  }
-  else
-    PRINTF(5)("SDL_net initialized\n");
-
-  PRINTF(0)("NetworkSocket created\n");
-
 }
 
 
 
-/**
- * Default destructor
- * dont use this from outside: use destroy() instead!!
- */
-NetworkSocket::~NetworkSocket( )
-{
-  this->terminateThread = true;
-  /* Quit SDL_net */
-  // NOTE: what if other instances of NetworkSocket running?
-  SDLNet_Quit();
-  PRINTF(5)("SDL_net shutdown\n");
-
-  SDL_DestroyMutex(incomingBufferMutex);
-  SDL_DestroyMutex(outgoingBufferMutex);
-  SDL_DestroyMutex(socketMutex);
-  SDL_DestroyMutex(threadTerminationMutex);
-}
-
-/**
- * This function establishes a TCP/UDP connection to a given server (function argument).
- * It is called by the NetworkStream. It creates a TCP/UDP socket for the connection.
- * @param ip
- */
-void NetworkSocket::connectToServer(IPaddress ip)
-{
-  //check if not already connected or listening
-  if (tcpSocket)
-  {
-    PRINTF(1)("NetworkSocket::listen: tcpSocket!=NULL! maybe you already called listen or connectToServer or did not call disconnectServer()!");
-  }
-
-  /* Connect to the host and port contained in ip using a TCP connection. */
-  tcpSocket = SDLNet_TCP_Open(&ip);
-  if(!tcpSocket)
-  {
-    PRINTF(1)("SDLNet_TCP_Open: %s\n", SDLNet_GetError());
-    return;
-  }
-
-  readThread = SDL_CreateThread(thread_read, (void*)this);
-  writeThread = SDL_CreateThread(thread_write, (void*)this);
-}
 
 
-/**
- * DTears down a TCP/UDP connection.
- */
-void NetworkSocket::disconnectServer( )
-{
-  terminateThread = true;
-  /* Close the connection */
-
-  SDL_mutexP(socketMutex);
-  SDLNet_TCP_Close(tcpSocket);
-  tcpSocket = NULL;
-  SDL_mutexV(socketMutex);
-}
-
-
-/**
- * This function writes some bytes (data) to the network connection (if the connection is already
- * estabilhed) otherwise it just does nothing (silently discarding the data). And writes some
- * warnings
- * @param data: pointer to the data to send
- * @param length: n bytes to send
- * @return the number successfully written bytes
- */
-int NetworkSocket::writeBytes(byte * data, int length)
-{
-  PRINTF(5)("NetworkSocket::writeBytes()\n");
-#ifdef _USE_OUTGOING_BUFFER
-
-#define min(a,b) (a<b)?a:b
-  int nbytes = min(_OUTGOING_BUFFER_SIZE - outgoingBufferLength, length);
-#undef min
-
-  if (!tcpSocket || data==NULL || nbytes<=0)
-  {
-    assert(_OUTGOING_BUFFER_SIZE - outgoingBufferLength > 0);
-    return 0;
-  }
-
-  SDL_mutexP(outgoingBufferMutex);
-
-  memcpy(outgoingBuffer + outgoingBufferLength, data, nbytes);
-  outgoingBufferLength += nbytes;
-
-  SDL_mutexV(outgoingBufferMutex);
-
-
-  return nbytes;
-#else
-  SDL_mutexP(socketMutex);
-
-  if (!tcpSocket || data==NULL)
-    return 0;
-
-  int res = SDLNet_TCP_Send(tcpSocket, data, length);
-
-  SDL_mutexV(socketMutex);
-
-  if (res<length)
-    PRINTF(1)("SDLNet_TCP_Send: %s\n", SDLNet_GetError());
-
-  return res;
-#endif
-}
-
-/**
- * Reads in the bytes from the network interface and passes it to the NetworkStream.
- * This function must internaly be implemented/connected as a thread, since the read
- * functions of many network libraries are blocking an would therefore block the whole
- * program.
- * From outside, the thread shouldn't be accessible at all.
- * @param data: pointer to memory, big enough to store length bytes
- * @param length: n bytes to read
- * @return the number successfully read bytes. -1 on error. may be less than length!
- */
-int NetworkSocket::readBytes(byte * data, int length)
-{
-  PRINTF(5)("NetworkSocket::readBytes()\n");
-  if (data==NULL)
-    return 0;
-
-  int nbytes = (length<incomingBufferLength) ? length : incomingBufferLength;
-
-
-  //printf("readBytes: nbytes = %d; length=%d; incomingBufferLength=%d\n", nbytes, length, incomingBufferLength);
-
-  // just in case ...
-  if (nbytes<0)
-    return -1;
-
-  if (nbytes==0)
-      return 0;
-
-  SDL_mutexP(incomingBufferMutex);
-
-  memcpy(data, incomingBuffer, nbytes);
-
-  //important: use memmove because the memory areas may overlap
-  memmove(incomingBuffer, incomingBuffer+nbytes, incomingBufferLength-nbytes);
-  incomingBufferLength -= nbytes;
-
-  SDL_mutexV(incomingBufferMutex);
-
-  return nbytes;
-}
-
-/**
- * Reads in the bytes form the network interface and passes it to the NetworkStream.
- * It only reads the bytes if there are enough bytes in our buffer.
- * @param data: pointer to memory, big enough to store length bytes
- * @param length: n bytes to read
- * @return the number successfully read bytes. -1 on error. 0 if there are not enough bytes in our buffer.
- */
-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);
-  else return 0;
-}
-
-
-/**
- * used to create a thread to read from socket
- * @param data: pointer to NetworkSocket
- */
-int NetworkSocket::thread_read( void * data )
-{
-  int nbytesread = 0;
-  int nbytestoread = 0;
-  char buffer[_LOCAL_BUFFER_SIZE];
-  NetworkSocket * self = (NetworkSocket*)data;
-
-  self->thread_read_running = true;
-
-  while (!self->terminateThread)
-  {
-#define min(a,b) (a<b)?a:b
-    nbytestoread = min(_INCOMING_BUFFER_SIZE - self->incomingBufferLength, _LOCAL_BUFFER_SIZE);
-#undef min
-
-    //if buffer is full
-    if (nbytestoread<=0 || !self->tcpSocket)
-    {
-      SDL_Delay(_MSECONDS_SLEEP_FULL_BUFFER);
-      continue;
-    }
-
-    nbytesread = SDLNet_TCP_Recv(self->tcpSocket, buffer, nbytestoread);
-
-    SDL_mutexP(self->incomingBufferMutex);
-
-    if (nbytesread<=0)
-    {
-      if (nbytesread<0)
-        printf("SDLNet_TCP_Recv: %s\n", SDLNet_GetError());
-
-      SDL_mutexP(self->socketMutex);
-
-      SDLNet_TCP_Close(self->tcpSocket);
-      self->tcpSocket = NULL;
-
-      SDL_mutexV(self->socketMutex);
-      SDL_mutexV(self->incomingBufferMutex);
-      continue;
-    }
-
-    //printf("thread_read: nbytesread=%d\n", nbytesread);
-
-    memcpy(self->incomingBuffer+self->incomingBufferLength, buffer, nbytesread);
-    self->incomingBufferLength += nbytesread;
-
-    SDL_mutexV(self->incomingBufferMutex);
-  }
-
-  SDL_mutexP(self->threadTerminationMutex);
-  self->thread_read_running = false;
-
-  if ( !self->thread_write_running )
-  {
-    //delete self;
-    SDL_mutexV(self->threadTerminationMutex);
-  }
-  else
-  {
-    SDL_mutexV(self->threadTerminationMutex);
-  }
-
-
-#ifdef DONTEXITTHREADS
-  while ( true )
-  {
-    SDL_Delay(1000);
-  }
-#endif
-  
-  PRINTF(0)("QUIT READ THREAD\n");
-  
-  return 0;
-}
-
-int NetworkSocket::thread_write( void * data )
-{
-  int nbyteswrite = 0;
-  int nbytestowrite = 0;
-  char buffer[_LOCAL_BUFFER_SIZE];
-  NetworkSocket * self = (NetworkSocket*)data;
-
-  self->thread_write_running = true;
-
-  while (!self->terminateThread)
-  {
-#define min(a,b) (a<b)?a:b
-    nbytestowrite = min(self->outgoingBufferLength, _LOCAL_BUFFER_SIZE);
-#undef min
-
-//     printf("thread_write nbytes=%d listening=%d\n", nbytestowrite, (int)self->_isListening);
-
-    //if buffer is full
-    if (nbytestowrite<=0 || !self->tcpSocket)
-    {
-      SDL_Delay(_MSECONDS_SLEEP_EMPTY_BUFFER);
-      continue;
-    }
-
-    SDL_mutexP(self->outgoingBufferMutex);
-
-    //printf("a\n");
-
-    memcpy(buffer, self->outgoingBuffer, nbytestowrite);
-    self->outgoingBufferLength -= nbytestowrite;
-    memmove(self->outgoingBuffer, self->outgoingBuffer+nbytestowrite, self->outgoingBufferLength);
-
-    SDL_mutexV(self->outgoingBufferMutex);
-
-    nbyteswrite = SDLNet_TCP_Send(self->tcpSocket, buffer, nbytestowrite);
-
-    if (nbyteswrite<=0)
-    {
-      printf("SDLNet_TCP_Recv: %s\n", SDLNet_GetError());
-
-      SDL_mutexP(self->socketMutex);
-
-      SDLNet_TCP_Close(self->tcpSocket);
-      self->tcpSocket = NULL;
-
-      SDL_mutexV(self->socketMutex);
-      continue;
-    }
-
-  }
-
-  SDL_mutexP(self->threadTerminationMutex);
-  self->thread_write_running = false;
-
-  if ( !self->thread_read_running )
-  {
-    //delete self;
-    SDL_mutexV(self->threadTerminationMutex);
-  }
-  else
-  {
-    SDL_mutexV(self->threadTerminationMutex);
-  }
-
-#ifdef DONTEXITTHREADS
-  while ( true )
-  {
-  SDL_Delay(1000);
-  }
-#endif
-
-  PRINTF(0)("QUIT WRITE THREAD\n");
-
-  return 0;
-  
-}
-
-bool NetworkSocket::writePacket( byte * data, int length )
-{
-  PRINTF(5)("NetworkSocket::writePacket() size=%d\n", length);
-
-  if ( length > 1024 )
-  PRINTF(2)("WARNING SENDING BIG PACKET SIZE = %d\n", length);
-
-  byte blen[INTSIZE];
-
-  Converter::intToByteArray( length, blen, INTSIZE );
-
-  writeBytes(blen, INTSIZE);
-  writeBytes(data, length);
-}
-
-int NetworkSocket::readPacket( byte * data, int maxLength )
-{
-  PRINTF(5)("NetworkSocket::readPacket()\n");
-  if (incomingBufferLength<INTSIZE)
-  {
-    return 0;
-  }
-
-  int blen;
-  Converter::byteArrayToInt( incomingBuffer, &blen );
-
-  if (blen>maxLength)
-  {
-    PRINTF(1)("Buffersize is too small (%d) for packet (%d).\n", maxLength, blen);
-    assert(false);
-    return 0;
-  }
-
-  if (blen>incomingBufferLength)
-  {
-    return 0;
-  }
-
-  byte t[INTSIZE];
-  readBytes(t, INTSIZE);
-  int res = readBytes(data, blen);
-
-  if (res!=blen)
-    return -1;
-  else
-    return blen;
-
-}
-
-
Index: /branches/network/src/lib/network/network_socket.h
===================================================================
--- /branches/network/src/lib/network/network_socket.h	(revision 7539)
+++ /branches/network/src/lib/network/network_socket.h	(revision 7540)
@@ -8,27 +8,4 @@
 #define _NETWORK_SOCKET
 
-//TODO HACK else gdb will not work on server
-#define DONTEXITTHREADS
-
-//if you want to use outgoing buffer define _USE_OUTGOING_BUFFER
-#define _USE_OUTGOING_BUFFER
-
-#define _INCOMING_BUFFER_SIZE 2024000
-#define _OUTGOING_BUFFER_SIZE 2024000
-#define _LOCAL_BUFFER_SIZE 1024
-//sleep if incoming buffer is full
-#define _MSECONDS_SLEEP_FULL_BUFFER 10
-//sleep if outgoing buffer is empty
-#define _MSECONDS_SLEEP_EMPTY_BUFFER 10
-
-
-/* contains memmove and memcpy */
-#include <string.h>
-
-#ifdef HAVE_SDL_H
- #include <SDL_thread.h>
-#else
- #include <SDL/SDL_thread.h>
-#endif
 /* include this file, it contains some default definitions */
 #include "netdefs.h"
@@ -38,66 +15,46 @@
 #include "base_object.h"
 
-/* using namespace std is default, this needs to be here */
-using namespace std;
-
 class NetworkSocket : public BaseObject
 {
+  public:
+    NetworkSocket();
+    virtual ~NetworkSocket();
 
-private:
-//  IPaddress serverAddress;
-//  unsigned int port;
-  TCPsocket tcpSocket;
-//  UDPsocket udpSocket;
+    /**
+     * connect to server on host with port port
+     * @param host hostname might be xxx.xxx.xxx.xxx or localhost ...
+     * @param port port to connect to
+     */
+    virtual void connectToServer( std::string host, int port ) = 0;
+    
+    /**
+     * disconnect from server
+     */
+    virtual void disconnectServer() = 0;
 
-  byte incomingBuffer[_INCOMING_BUFFER_SIZE];
-#ifdef _USE_OUTGOING_BUFFER
-  byte outgoingBuffer[_OUTGOING_BUFFER_SIZE];
-#endif
-  int incomingBufferLength;
-#ifdef _USE_OUTGOING_BUFFER
-  int outgoingBufferLength;
-#endif
+    /**
+     * send packet to connected socket. will be recieved as whole packet
+     * @param data pointer to data to send
+     * @param length lengt of packet to send
+     * @return true on success
+     */
+    virtual bool writePacket(byte * data, int length) = 0;
+    
+    /**
+     * read a packet sent by another NetworkSocket
+     * @param data data will be copied here
+     * @param maxLength readPacket will not read more than maxLength
+     * @return bytes read. on error less than zero
+     */
+    virtual int readPacket(byte * data, int maxLength) = 0;
 
-  SDL_mutex * incomingBufferMutex;
-#ifdef _USE_OUTGOING_BUFFER
-  SDL_mutex * outgoingBufferMutex;
-#endif
-  SDL_mutex * socketMutex;
-  bool terminateThread;
-
-  SDL_mutex* threadTerminationMutex;
-  static int thread_read(void * data);
-  bool thread_read_running;
-  bool thread_write_running;
-
-  SDL_Thread*            readThread;
-  SDL_Thread*            writeThread;
-
-#ifdef _USE_OUTGOING_BUFFER
-  static int thread_write(void * data);
-#endif
-
-  int writeBytes(byte * data, int length);
-  int readBytes(byte * data, int length);
-  int readBlock(byte * data, int length);
-
-  void init();
-
-public:
-
-  NetworkSocket();
-  virtual ~NetworkSocket();
-  NetworkSocket(IPaddress ip);
-  NetworkSocket(TCPsocket sock);
-  void destroy() { terminateThread = true; };
-
-
-  void connectToServer(IPaddress ip);
-  void disconnectServer();
-
-  bool writePacket(byte * data, int length);
-  int readPacket(byte * data, int maxLength);
-
-  inline bool isOk() { return tcpSocket!=NULL; }
+    /**
+     * check if socket is ok
+     * @return true if socket is ok
+     */
+    inline bool isOk() { return this->bOk; }
+  
+  protected:
+    bool bOk;            //!< check for socket status
 
 };
Index: /branches/network/src/lib/network/network_stream.cc
===================================================================
--- /branches/network/src/lib/network/network_stream.cc	(revision 7539)
+++ /branches/network/src/lib/network/network_stream.cc	(revision 7540)
@@ -23,5 +23,6 @@
 #include "base_object.h"
 #include "network_protocol.h"
-#include "network_socket.h"
+#include "tcp_socket.h"
+#include "tcp_server_socket.h"
 #include "connection_monitor.h"
 #include "synchronizeable.h"
@@ -54,9 +55,9 @@
 
 
-NetworkStream::NetworkStream(IPaddress& address)
+NetworkStream::NetworkStream( std::string host, int port )
 {
   this->type = NET_CLIENT;
   this->init();
-  this->networkSockets.push_back(new NetworkSocket(address));
+  this->networkSockets.push_back(new TcpSocket( host, port ));
   this->networkProtocol = new NetworkProtocol();
   this->connectionMonitor = new ConnectionMonitor();
@@ -65,9 +66,9 @@
 
 
-NetworkStream::NetworkStream(unsigned int port)
+NetworkStream::NetworkStream( int port)
 {
   this->type = NET_SERVER;
   this->init();
-  this->serverSocket = new ServerSocket(port);
+  this->serverSocket = new TcpServerSocket(port);
   this->networkProtocol = new NetworkProtocol();
   this->connectionMonitor = new ConnectionMonitor();
@@ -103,5 +104,4 @@
     {
       (*i)->disconnectServer();
-      (*i)->destroy();
     }
   }
@@ -175,5 +175,4 @@
       //delete networkSockets[i];
       networkSockets[0]->disconnectServer();
-      networkSockets[0]->destroy();
       networkSockets[0] = NULL;
 
@@ -241,11 +240,4 @@
       do {
         counter++;
-
-        //check for endless loop
-        if ( counter > 50 )
-        {
-          PRINTF(1)("there seems to be an error in readBytes of %s\n", (*it)->getClassName());
-          assert(false);
-        }
 
         reciever = 0;
@@ -415,5 +407,4 @@
       //delete networkSockets[i];
       networkSockets[i]->disconnectServer();
-      networkSockets[i]->destroy();
       networkSockets[i] = NULL;
 
Index: /branches/network/src/lib/network/network_stream.h
===================================================================
--- /branches/network/src/lib/network/network_stream.h	(revision 7539)
+++ /branches/network/src/lib/network/network_stream.h	(revision 7540)
@@ -32,6 +32,6 @@
   public:
     NetworkStream();
-    NetworkStream(IPaddress& address);
-    NetworkStream(unsigned int port);
+    NetworkStream( std::string host, int port);
+    NetworkStream( int port );
 
     virtual ~NetworkStream();
Index: /branches/network/src/lib/network/server_socket.cc
===================================================================
--- /branches/network/src/lib/network/server_socket.cc	(revision 7539)
+++ /branches/network/src/lib/network/server_socket.cc	(revision 7540)
@@ -27,165 +27,14 @@
 
 
-ServerSocket::ServerSocket( ConnectionType connectionType )
+/**
+ * constructor
+ * @param port port to assign to socket
+ */
+ServerSocket::ServerSocket( int port )
 {
-  this->connectionType = connectionType;
-  init();
+  bOk = true;
 }
 
-
-ServerSocket::ServerSocket( ConnectionType connectionType, unsigned int port )
+ServerSocket::~ ServerSocket( )
 {
-  this->connectionType = connectionType;
-  init();
-  listen(port);
 }
-
-
-ServerSocket::ServerSocket()
-{
-  this->connectionType == NET_TCP;
-  init();
-}
-
-
-ServerSocket::ServerSocket( unsigned int port )
-{
-  this->connectionType == NET_TCP;
-  init();
-  listen(port);
-}
-
-
-/**
- * Default destructor
- */
-ServerSocket::~ServerSocket( )
-{
-  /* Quit SDL_net */
-  // NOTE: what if other instances of NetworkSocket running?
-  SDLNet_Quit();
-  PRINTF(5)("SDL_net shutdown\n");
-
-  _isListening = false;
-}
-
-
-
-
-void ServerSocket::init( )
-{
-  /* set the class id for the base object */
-  this->setClassID(CL_SERVER_SOCKET, "ServerSocket");
-
-  terminateThread = false;
-  listenSocket = NULL;
-  _isListening = false;
-
-  if(SDLNet_Init()==-1)
-  {
-    PRINTF(1)("SDLNet_Init: %s\n", SDLNet_GetError());
-    return;
-  }
-  else
-    PRINTF(5)("SDL_net initialized\n");
-
-  PRINTF(0)("ServerSocket created\n");
-}
-
-
-/**
- * Tells the NetworkSocket to listen on a specific port for incoming connections.
- * NetworkSocket::writeBytes(...) will have no effect until there is a valuable connection.
- * @param port
- */
-bool ServerSocket::listen(unsigned int port)
-{
-  PRINTF(0)("ServerSocket::listen()\n");
-  _isListening = true;
-  //check if not already connected or listening
-  if (listenSocket)
-  {
-    PRINTF(1)("ServerSocket::listen: tcpSocket!=NULL! maybe you already called listen or did not call close()!\n");
-    _isListening = false;
-    return false;
-  }
-
-  IPaddress ip;
-
-  if (SDLNet_ResolveHost(&ip, NULL, port)==-1)
-  {
-    PRINTF(1)("SDLNet_ResolveHost: %s\n", SDLNet_GetError());
-    _isListening = false;
-    return false;
-  }
-
-  if( this->connectionType == NET_TCP)
-  {
-    listenSocketTCP = SDLNet_TCP_Open(&ip);
-    if( !listenSocketTCP) {
-      PRINTF(1)("SDLNet_TCP_Open: %s\n", SDLNet_GetError());
-      _isListening = false;
-      return false;
-    }
-  }
-  else
-  {
-    listenSocketUDP = SDLNet_UDP_Open(port);
-    PRINTF(1)("SDLNet_UDP_Open: %s\n", SDLNet_GetError());
-    _isListening = false;
-    return false;
-  }
-
-
-  return true;
-}
-
-
-/**
- *  returns a new NetworkSocket
- * @return new socket
- */
-NetworkSocket* ServerSocket::getNewSocket( )
-{
-  if ( !listenSocket )
-  {
-    PRINTF(1)("listenSocket == NULL! Maybe you forgot to call listen()\n");
-    close();
-    return NULL;
-  }
-
-  if( this->connectionType == NET_TCP)
-  {
-    TCPsocket sockTCP = SDLNet_TCP_Accept(this->listenSocketTCP);
-    if( !sockTCP)
-      return NULL;
-    else
-      return new NetworkSocket(sockTCP);
-  }
-  else
-  {
-#warning UDP getNewSocket incomplet
-//     UDPsocket sockUDP = SDLNet_UDP_Accept(this->listenSocketUDP);
-//     if( !sockUDP)
-//       return NULL;
-
-//     else
-//       return new NetworkSocket();
-  }
-}
-
-
-/**
- * closes the ServerSocket
- */
-void ServerSocket::close( )
-{
-  if ( listenSocket )
-  {
-    SDLNet_TCP_Close( listenSocket );
-    listenSocket = NULL;
-  }
-
-  _isListening = false;
-}
-
Index: /branches/network/src/lib/network/server_socket.h
===================================================================
--- /branches/network/src/lib/network/server_socket.h	(revision 7539)
+++ /branches/network/src/lib/network/server_socket.h	(revision 7540)
@@ -8,9 +8,4 @@
 #define _SERVER_SOCKET
 
-#ifdef HAVE_SDL_H
-#include <SDL_thread.h>
-#else
-#include <SDL/SDL_thread.h>
-#endif
 /* include this file, it contains some default definitions */
 #include "netdefs.h"
@@ -21,40 +16,19 @@
 #include "network_socket.h"
 
-//sleep when waiting for connections
-#define _MSECONDS_SLEEP_LISTEN 100
-
 
 class ServerSocket : public BaseObject
 {
   public:
-#warning old socket structure
-    ServerSocket();
-    ServerSocket(unsigned int port);
+    ServerSocket( int port);
 
-    ServerSocket(ConnectionType connectionType);
-    ServerSocket(ConnectionType connectionType, unsigned int port );
     virtual ~ServerSocket();
 
-    bool listen( unsigned int port );
-    NetworkSocket* getNewSocket( void );
-    void close();
-    inline bool isOk(){ return listenSocket!=NULL; }
+    virtual bool listen( unsigned int port ) = 0;
+    virtual NetworkSocket* getNewSocket( void ) = 0;
+    virtual void close() = 0;
+    virtual bool isOk() { return this->bOk; };
 
-
-  private:
-    void init();
-
-
-  private:
-#warning old socket structure
-    TCPsocket         listenSocket;
-
-    ConnectionType    connectionType;                        //!< the connection type of the socket {TCP,UDP}
-    TCPsocket         listenSocketTCP;                       //!< tcp socket
-    UDPsocket         listenSocketUDP;                       //!< udp socket
-    bool              terminateThread;                       //!< true if thread terminated
-
-    bool              _isListening;                          //!< true if listening
-
+  protected:
+    bool bOk;
 
 };
Index: /branches/network/src/lib/network/tcp_server_socket.cc
===================================================================
--- /branches/network/src/lib/network/tcp_server_socket.cc	(revision 7540)
+++ /branches/network/src/lib/network/tcp_server_socket.cc	(revision 7540)
@@ -0,0 +1,42 @@
+/*
+   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: Christoph Renner
+   co-programmer:
+*/
+
+#include "tcp_server_socket.h"
+
+
+
+/**
+ * constructor which listens on port
+ * @param port port
+ */
+TcpServerSocket::TcpServerSocket( int port ) : ServerSocket( port )
+{
+}
+
+TcpServerSocket::~TcpServerSocket( )
+{
+}
+
+bool TcpServerSocket::listen( unsigned int port )
+{
+}
+
+NetworkSocket * TcpServerSocket::getNewSocket( void )
+{
+}
+
+void TcpServerSocket::close( )
+{
+}
Index: /branches/network/src/lib/network/tcp_server_socket.h
===================================================================
--- /branches/network/src/lib/network/tcp_server_socket.h	(revision 7540)
+++ /branches/network/src/lib/network/tcp_server_socket.h	(revision 7540)
@@ -0,0 +1,32 @@
+/*!
+ * @file server_socket.h
+ *  waits for incoming connections
+
+ */
+
+#ifndef _TCP_SERVER_SOCKET
+#define _TCP_SERVER_SOCKET
+
+/* include this file, it contains some default definitions */
+#include "netdefs.h"
+
+
+/* include base_object.h since all classes are derived from this one */
+#include "base_object.h"
+#include "server_socket.h"
+
+
+class TcpServerSocket : public ServerSocket
+{
+  public:
+    TcpServerSocket( int port );
+
+    virtual ~TcpServerSocket();
+
+    virtual bool listen( unsigned int port );
+    virtual NetworkSocket* getNewSocket( void );
+    virtual void close();
+ 
+};
+
+#endif
Index: /branches/network/src/lib/network/tcp_socket.cc
===================================================================
--- /branches/network/src/lib/network/tcp_socket.cc	(revision 7540)
+++ /branches/network/src/lib/network/tcp_socket.cc	(revision 7540)
@@ -0,0 +1,74 @@
+/*
+   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: Christoph Renner
+   co-programmer:
+*/
+
+#include "tcp_socket.h"
+
+/**
+ * constructor which connects to host
+ */
+TcpSocket::TcpSocket( std::string host, int port )
+{
+} 
+
+/**
+ * default constructor
+ */
+TcpSocket::TcpSocket( )
+{
+}
+
+/**
+ * default destructor
+ */
+TcpSocket::~TcpSocket( )
+{
+}
+    
+/**
+ * read a packet sent by another NetworkSocket
+ * @param data data will be copied here
+ * @param maxLength readPacket will not read more than maxLength
+ * @return bytes read. on error less than zero
+ */
+int TcpSocket::readPacket( byte * data, int maxLength )
+{
+}
+
+/**
+ * send packet to connected socket. will be recieved as whole packet
+ * @param data pointer to data to send
+ * @param length lengt of packet to send
+ * @return true on success
+ */
+bool TcpSocket::writePacket( byte * data, int length )
+{
+}
+
+/**
+ * disconnect from server
+ */
+void TcpSocket::disconnectServer( )
+{
+}
+
+/**
+ * connect to server on host with port port
+ * @param host hostname might be xxx.xxx.xxx.xxx or localhost ...
+ * @param port port to connect to
+ */
+void TcpSocket::connectToServer( std::string host, int port )
+{
+}
+
Index: /branches/network/src/lib/network/tcp_socket.h
===================================================================
--- /branches/network/src/lib/network/tcp_socket.h	(revision 7540)
+++ /branches/network/src/lib/network/tcp_socket.h	(revision 7540)
@@ -0,0 +1,37 @@
+/*!
+ * @file network_socket.h
+  *  Main interface for the network module. Manages all the modules
+
+*/
+
+#ifndef _TCP_SOCKET
+#define _TCP_SOCKET
+
+/* include this file, it contains some default definitions */
+#include "netdefs.h"
+
+
+/* include base_object.h since all classes are derived from this one */
+#include "network_socket.h"
+
+class TcpSocket : public NetworkSocket
+{
+  public:
+    TcpSocket();
+    TcpSocket( std::string host, int port );
+    virtual ~TcpSocket();
+
+    virtual void connectToServer( std::string host, int port );
+    
+    virtual void disconnectServer();
+
+    virtual bool writePacket(byte * data, int length);
+
+    virtual int readPacket(byte * data, int maxLength);
+
+
+};
+
+
+
+#endif /* _NETWORK_SOCKET */
Index: /branches/network/src/lib/network/udp_server_socket.cc
===================================================================
--- /branches/network/src/lib/network/udp_server_socket.cc	(revision 7540)
+++ /branches/network/src/lib/network/udp_server_socket.cc	(revision 7540)
@@ -0,0 +1,257 @@
+/*
+   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: Christoph Renner
+   co-programmer:
+*/
+
+#include "udp_server_socket.h"
+
+
+
+/**
+ * constructor
+ * @param port port to listen on 
+ */
+UdpServerSocket::UdpServerSocket( int port ) : ServerSocket( port )
+{
+  packet = SDLNet_AllocPacket( UDP_PACKET_SIZE );
+  
+  if ( !packet )
+  {
+    PRINTF(1)("SDLNet_AllocPacket: %s\n", SDLNet_GetError());
+    
+    assert( false );
+    bOk = false;
+  }
+  
+  listen( port );
+}
+
+/**
+ * default destructor
+ */
+UdpServerSocket::~UdpServerSocket( )
+{
+  for ( int i = 0; i < packetBuffer.size(); i++ )
+    removeUserPackets( i );
+}
+
+/**
+ * tell udpServerSocket to recieve packets on port
+ * @param port port
+ * @return true on success
+ */
+bool UdpServerSocket::listen( unsigned int port )
+{
+  socket = SDLNet_UDP_Open( port );
+  
+  if ( !socket )
+  {
+    
+    bOk = false;
+    return false;
+  }
+  
+  return true;
+}
+
+/**
+ * get newly connected socket. note: this function will also recieve
+ * packets and create new sockets
+ * @return new socket or NULL if no new socket exists
+ */
+NetworkSocket * UdpServerSocket::getNewSocket( void )
+{
+  int res;
+  int newConn = 0;
+  
+  for ( res = SDLNet_UDP_Recv( socket, packet ); res == 1; res = SDLNet_UDP_Recv( socket, packet ) )
+  {
+    int userId;
+    
+    for ( userId =0; userId < userList.size(); userId++ )
+      if ( userList[userId].host == packet->address.host && userList[userId].port == packet->address.port )
+        break;
+    
+    if ( userId >= userList.size() )
+    {
+      newConn++;
+      
+      if ( newConn > MAX_NEW_CONNECTIONS )
+      {
+        PRINTF(2)("Too many new connections. Dropping packet\n");
+        continue;
+      }
+      
+      for ( userId =0; userId < userList.size(); userId++ )
+        if ( userList[userId].host == 0 && userList[userId].port == 0 )
+          break;
+      
+      initUser( userId, packet->address );
+      UdpSocket * sock = new UdpSocket( this, packet->address, userId );
+      newSocketList.push_back( sock );
+    }
+    
+    //add new packet to packetbuffer
+    NetworkPacket networkPacket;
+    networkPacket.length = packet->len;
+    networkPacket.data = (byte*)malloc( packet->len );
+    assert( networkPacket.data );
+    memcpy( networkPacket.data, packet->data, packet->len );
+    packetBuffer[userId].push_back( networkPacket );
+  }
+  
+  assert( res = 0 );
+  
+  NetworkSocket * result = newSocketList.front();
+  
+  newSocketList.pop_front();
+  
+  return result;
+}
+
+/**
+ * stop listening on server
+ */
+void UdpServerSocket::close( )
+{
+  
+  for ( int i = 0; i < packetBuffer.size(); i++ )
+    removeUserPackets( i );
+  
+  packetBuffer.clear();
+  userList.clear();
+  
+  SDLNet_UDP_Close( socket );
+  socket = NULL;
+}
+
+/**
+ * clean up users buffer
+ * @param userId users userid
+ */
+void UdpServerSocket::removeUserPackets( int userId )
+{
+  if ( userId >= packetBuffer.size() )
+    return;
+  
+  for ( NetworkPacketList::iterator it = packetBuffer[userId].begin(); it!=packetBuffer[userId].end(); it++ )
+  {
+    if ( it->data )
+    {
+      delete it->data;
+      it->data = NULL;
+    }
+  }
+  
+  packetBuffer[userId].clear();
+}
+
+/**
+ * get next packet for user
+ * @param userId user id
+ * @return recieved packet or packet with length 0 if no packet available
+ */
+NetworkPacket UdpServerSocket::getPacket( int userId )
+{
+  NetworkPacket res;
+  res.data = NULL;
+  res.length = 0;
+  
+  if ( packetBuffer.size() > userId && packetBuffer[userId].size() > 0 )
+  {
+    res.data = packetBuffer[userId].front().data;
+    res.length = packetBuffer[userId].front().length;
+    packetBuffer[userId].pop_front();
+  }
+  
+  return res;
+}
+
+/**
+ * get number of packets recieved for user
+ * @param userId user id
+ * @return number of packets in buffer
+ */
+int UdpServerSocket::getPacketCount( int userId )
+{
+  if ( userId >= packetBuffer.size() )
+    return -1;
+  
+  return packetBuffer[userId].size();
+}
+
+/**
+ * will set user state 
+ * @param userId users id
+ * @param ip users host / port
+ */
+void UdpServerSocket::initUser( int userId, IPaddress ip )
+{
+  int channel = SDLNet_UDP_Bind( socket, userId, &ip );
+  if( channel == userId ) 
+  {
+    PRINTF(1)("SDLNet_UDP_Bind: %s\n", SDLNet_GetError());
+    assert(false);
+    return;
+  }
+  
+  if ( userId < packetBuffer.size() )
+    removeUserPackets( userId );
+  
+  if ( packetBuffer.size() <= userId )
+    packetBuffer.resize( userId + 1 );
+  
+  if ( userList.size() <= userId )
+    userList.resize( userId + 1 );
+  
+  userList[ userId ] = ip;
+}
+
+/**
+ * remove user from list
+ * @param userId user id
+ */
+void UdpServerSocket::removeUser( int userId )
+{
+  removeUserPackets( userId );
+  
+  if ( userId >= userList.size() )
+    return;
+  
+  userList[userId].host = 0;
+  userList[userId].port = 0;
+  
+  SDLNet_UDP_Unbind( socket, userId );
+}
+
+/**
+ * send one packet to client associated to userId
+ * @param networkPacket packet to send
+ * @param userId users id
+ * @return true on success
+ */
+bool UdpServerSocket::sendPacket( NetworkPacket networkPacket , int userId )
+{
+  assert( networkPacket.length <= UDP_PACKET_SIZE );
+  
+  memcpy( packet->data, networkPacket.data, networkPacket.length );
+  packet->len = networkPacket.length;
+  
+  if ( SDLNet_UDP_Send( socket, userId, packet ) == 0 )
+  {
+    PRINTF(1)("SDLNet_UDP_Send: %s\n", SDLNet_GetError());
+    return false;
+  }
+  
+  return true;
+}
Index: /branches/network/src/lib/network/udp_server_socket.h
===================================================================
--- /branches/network/src/lib/network/udp_server_socket.h	(revision 7540)
+++ /branches/network/src/lib/network/udp_server_socket.h	(revision 7540)
@@ -0,0 +1,68 @@
+/*!
+ * @file udp_server_socket.h
+ *  waits for incoming connections
+
+ */
+
+#ifndef _UDP_SERVER_SOCKET
+#define _UDP_SERVER_SOCKET
+
+/* include this file, it contains some default definitions */
+#include "netdefs.h"
+
+
+/* include base_object.h since all classes are derived from this one */
+#include "base_object.h"
+#include "server_socket.h"
+#include "udp_socket.h"
+
+#include <list>
+#include <vector>
+
+#define UDP_PACKET_SIZE 1024
+#define MAX_NEW_CONNECTIONS 8
+
+struct NetworkPacket
+{
+  int length;
+  byte * data;
+};
+
+typedef std::list<NetworkPacket> NetworkPacketList;
+
+typedef std::vector<NetworkPacketList> PacketBuffer;
+
+typedef std::vector<IPaddress> UserList;
+
+typedef std::list<UdpSocket*> UdpSocketList;
+
+class UdpServerSocket : public ServerSocket
+{
+  public:
+    UdpServerSocket( int port);
+
+    virtual ~UdpServerSocket();
+
+    virtual bool listen( unsigned int port );
+    
+    virtual NetworkSocket* getNewSocket( void );
+    
+    virtual void close();
+    
+    void removeUserPackets( int userId );
+    void removeUser( int userId );
+    NetworkPacket getPacket( int userId );
+    bool sendPacket( NetworkPacket networkPacket, int userId );
+    int getPacketCount( int childId );
+    void initUser( int childId, IPaddress ip );
+    
+  private:
+    UDPsocket     socket;           //!< will be uses to send/recieve data
+    UDPpacket *   packet;           //!< packet structure to recieve packet
+    PacketBuffer  packetBuffer;     //!< will store recieved packets for UdpSockets
+    UserList      userList;         //!< contains information about clients
+    UdpSocketList newSocketList;    //!< contains new socket
+
+};
+
+#endif
Index: /branches/network/src/lib/network/udp_socket.cc
===================================================================
--- /branches/network/src/lib/network/udp_socket.cc	(revision 7540)
+++ /branches/network/src/lib/network/udp_socket.cc	(revision 7540)
@@ -0,0 +1,219 @@
+/*
+   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: Christoph Renner
+   co-programmer:
+*/
+
+#include "udp_socket.h"
+#include "udp_server_socket.h"
+
+
+void UdpSocket::init( )
+{
+  this->serverSocket = NULL;
+  this->socket = NULL;
+  this->packet = NULL;
+}
+
+
+/**
+ * constructor - connects to give host
+ * @param host host
+ * @param port port
+ */
+UdpSocket::UdpSocket( std::string host, int port )
+{
+  init();
+  this->packet = SDLNet_AllocPacket( UDP_PACKET_SIZE );
+  
+  this->connectToServer( host, port );
+}
+
+/**
+ * default constructor. use this one if you want to call connecttoServer
+ */
+UdpSocket::UdpSocket( )
+{
+  this->init();
+  this->packet = SDLNet_AllocPacket( UDP_PACKET_SIZE );
+  
+  if ( !packet )
+  {
+    PRINTF(1)("SDLNet_AllocPacket: %s\n", SDLNet_GetError());
+    
+    assert( false );
+    bOk = false;
+  }
+  
+}
+
+/**
+ * constructor. used by UdpServerSocket
+ * @param serverSocket pointer to serverSocket
+ * @param ip client's ip address
+ * @param userId userid used by serverSocket
+ */
+UdpSocket::UdpSocket( UdpServerSocket * serverSocket, IPaddress ip, int userId )
+{
+  this->init();
+  this->serverSocket = serverSocket;
+}
+
+/**
+ * destructor
+ */
+UdpSocket::~ UdpSocket( )
+{
+  if ( serverSocket )
+    serverSocket->removeUser( userId );
+  
+  disconnectServer();
+}
+
+/**
+ * connect to server
+ * @param host host name
+ * @param port port number
+ */
+void UdpSocket::connectToServer( std::string host, int port )
+{
+  assert( serverSocket == NULL );
+  
+  IPaddress ip;
+  
+  if ( SDLNet_ResolveHost( &ip, host.c_str(), port ) != 0 )
+  {
+    PRINTF(1)("SDLNet_ResolveHost: %s\n", SDLNet_GetError() );
+    bOk = false;
+    return;
+  }
+  
+  socket = SDLNet_UDP_Open(0);
+  if ( !socket )
+  {
+    PRINTF(1)("SDLNet_UDP_Open: %s\n", SDLNet_GetError() );
+    bOk = false;
+    return;
+  }
+  
+  int channel = SDLNet_UDP_Bind(socket, -1, &ip);
+  if ( channel == -1 ) 
+  {
+    PRINTF(2)("SDLNet_UDP_Bind: %s\n", SDLNet_GetError());
+    bOk = false;
+    return;
+  }
+}
+
+/**
+ * disconnect from server
+ */
+void UdpSocket::disconnectServer( )
+{
+  SDLNet_UDP_Unbind( socket, -1 );
+  SDLNet_UDP_Close( socket );
+  socket = NULL;
+}
+
+/**
+ * send one packet to other host
+ * @param data pointer to data which will be sent
+ * @param length length of data
+ * @return true on success
+ */
+bool UdpSocket::writePacket( byte * data, int length )
+{
+  if ( serverSocket )
+  {
+    NetworkPacket networkPacket;
+    networkPacket.length = length;
+    networkPacket.data = data;
+    if ( !serverSocket->sendPacket( networkPacket, this->userId ) )
+    {
+      bOk = false;
+      return false;
+    }
+    else
+      return true;
+  }
+  else
+  {
+    assert( length <= packet->maxlen );
+    
+    memcpy( packet->data, data, length );
+    packet->len = length;
+    
+    if ( SDLNet_UDP_Send( socket, 1, packet) == 0 )
+    {
+      PRINTF(1)("SDLNet_UDP_Send: %s\n", SDLNet_GetError());
+      bOk = false;
+      return false;
+    }
+    
+    return true;
+  }
+}
+
+/**
+ * recieve one packet from another host
+ * @param data pointer to buffer to copy data into
+ * @param maxLength maximal length of buffer
+ * @return less than 0 on error, number bytes read else
+ */
+int UdpSocket::readPacket( byte * data, int maxLength )
+{
+  if ( serverSocket )
+  {
+    NetworkPacket networkPacket = serverSocket->getPacket( this->userId );
+    
+    if ( networkPacket.length > 0 )
+    {
+      assert( maxLength > networkPacket.length );
+      
+      memcpy( data, networkPacket.data, networkPacket.length );
+    }
+    
+    if ( networkPacket.data )
+    {
+      delete networkPacket.data;
+      networkPacket.data = NULL;
+    }
+    
+    return networkPacket.length;
+  }
+  else
+  {
+    int numrecv = SDLNet_UDP_Recv( socket, packet);
+    if ( numrecv > 0) 
+    {
+      assert( packet->len <= maxLength );
+      
+      memcpy( data, packet->data, packet->len );
+      return packet->len;
+    }
+    else if ( numrecv < 0 )
+    {
+      PRINTF(1)("SDLNet_UDP_Recv: %s\n", SDLNet_GetError());
+      bOk = false;
+      return -1;
+    }
+    else
+    {
+      return 0;
+    }
+  }
+  
+  return 0;
+}
+
+
+
Index: /branches/network/src/lib/network/udp_socket.h
===================================================================
--- /branches/network/src/lib/network/udp_socket.h	(revision 7540)
+++ /branches/network/src/lib/network/udp_socket.h	(revision 7540)
@@ -0,0 +1,47 @@
+/*!
+ * @file upd_socket.h
+ *  class to connect to other clients via udp
+ */
+
+#ifndef _UDP_SOCKET
+#define _UDP_SOCKET
+
+/* include this file, it contains some default definitions */
+#include "netdefs.h"
+
+
+/* include base_object.h since all classes are derived from this one */
+#include "network_socket.h"
+
+class UdpServerSocket;
+
+class UdpSocket : public NetworkSocket
+{
+  public:
+    UdpSocket();
+    UdpSocket( UdpServerSocket * serverSocket, IPaddress ip, int userId );
+    UdpSocket( std::string host, int port );
+    virtual ~UdpSocket();
+
+    virtual void connectToServer( std::string host, int port );
+    
+    virtual void disconnectServer();
+
+    virtual bool writePacket(byte * data, int length);
+
+    virtual int readPacket(byte * data, int maxLength);
+    
+  private:
+    UdpServerSocket * serverSocket;   //!< will get packets here
+    int               userId;         //!< user id used by serverSocket
+    IPaddress         ip;             //!< host,port
+    UDPsocket         socket;         //!< socket used to send/recieve
+    UDPpacket *       packet;
+    
+    void init();
+
+};
+
+
+
+#endif /* _NETWORK_SOCKET */
