Index: code/trunk/src/libraries/network/GamestateManager.h
===================================================================
--- code/trunk/src/libraries/network/GamestateManager.h	(revision 9667)
+++ code/trunk/src/libraries/network/GamestateManager.h	(revision 10622)
@@ -1,3 +1,3 @@
-/*
+  /*
  *   ORXONOX - the hottest 3D action shooter ever to exist
  *                    > www.orxonox.net <
@@ -78,7 +78,7 @@
       std::map< uint32_t, packet::Gamestate* > gamestates;
     };
-    
+
   public:
-    
+
     GamestateManager();
     ~GamestateManager();
@@ -88,5 +88,5 @@
     virtual uint32_t  getLastReceivedGamestateID( unsigned int peerID );
     virtual uint32_t  getCurrentGamestateID(){ if( currentGamestate_) return currentGamestate_->getID(); else return GAMESTATEID_INITIAL; }
-    
+
     bool processGamestates();
     bool sendAck(unsigned int gamestateID, uint32_t peerID);
Index: code/trunk/src/libraries/network/LANDiscoverable.cc
===================================================================
--- code/trunk/src/libraries/network/LANDiscoverable.cc	(revision 9667)
+++ code/trunk/src/libraries/network/LANDiscoverable.cc	(revision 10622)
@@ -35,4 +35,7 @@
 #include "util/Output.h"
 #include "packet/ServerInformation.h"
+#include "core/config/ConfigValueIncludes.h"
+#include "core/CoreIncludes.h"
+
 
 namespace orxonox
@@ -43,7 +46,19 @@
   LANDiscoverable::LANDiscoverable()
   {
+    /* register object in orxonox */
+    RegisterObject(LANDiscoverable);
+
+    this->setConfigValues();
+    //     this->setActivity(true);
     this->host_ = 0;
     this->bActive_ = false;
-//     this->setActivity(true);
+  }
+
+  void LANDiscoverable::setConfigValues()
+  {
+    /* update ownName string from orxonox.ini config file, if it
+     * has changed.
+     */
+    SetConfigValueExternal(ownName, "Discovery", "ownName", "OrxServer");
   }
 
@@ -61,5 +76,5 @@
     if( bActive == this->bActive_ )        // no change
       return;
-    
+
     if( bActive )
     {
@@ -84,9 +99,9 @@
   {
     ENetEvent event;
-    
+
     if( this->bActive_==false )
       return;
     assert(this->host_);
-    
+
     while( enet_host_service( this->host_, &event, 0 ) > 0 )
     {
@@ -104,5 +119,6 @@
             orxout(internal_info, context::network) << "Received LAN discovery message from client " << event.peer->host->receivedAddress << endl;
             packet::ServerInformation info;
-            info.setServerName("Orxonox Server");
+            info.setServerName(this->ownName);
+            info.setClientNumber(this->clientNumber);
             info.send(event.peer);
 //             ENetPacket* packet = enet_packet_create( LAN_DISCOVERY_ACK, strlen(LAN_DISCOVERY_ACK)+1, ENET_PACKET_FLAG_RELIABLE );
Index: code/trunk/src/libraries/network/LANDiscoverable.h
===================================================================
--- code/trunk/src/libraries/network/LANDiscoverable.h	(revision 9667)
+++ code/trunk/src/libraries/network/LANDiscoverable.h	(revision 10622)
@@ -31,9 +31,10 @@
 
 #include "NetworkPrereqs.h"
+#include "core/config/Configurable.h"
 
 namespace orxonox
 {
 
-  class LANDiscoverable
+  class LANDiscoverable: public Configurable
   {
     public:
@@ -42,8 +43,14 @@
       void setActivity( bool bActive );
       void update();
+      void updateClientNumber(int clientNumber) {this->clientNumber = clientNumber;}
+;
+      /** Function used for the configuration file parameter update */
+      void setConfigValues();
 
     private:
       bool            bActive_;
       ENetHost*       host_;
+      std::string     ownName;
+      int             clientNumber;
   };
 
Index: code/trunk/src/libraries/network/LANDiscovery.cc
===================================================================
--- code/trunk/src/libraries/network/LANDiscovery.cc	(revision 9667)
+++ code/trunk/src/libraries/network/LANDiscovery.cc	(revision 10622)
@@ -89,5 +89,8 @@
           {
             packet::ServerInformation info(&event);
-            orxout(internal_info, context::network) << "Received LAN discovery server information; Name: " << info.getServerName() << ", Address: " << info.getServerIP() << ", RTT: " << info.getServerRTT() << endl;
+            std::string payload = info.getServerName();
+            info.setServerName(payload.substr(0,payload.length()-2));
+            info.setClientNumber( Ogre::StringConverter::parseInt(payload.substr(payload.length()-1)));
+            orxout(internal_info, context::network) << "Received LAN discovery server information; Name: " << info.getServerName() << ", Address: " << info.getServerIP() << ", Players: " << info.getClientNumber() << ", RTT: " << info.getServerRTT() << endl;
             std::vector<packet::ServerInformation>::iterator it;
             for( it=this->servers_.begin(); it!=this->servers_.end(); ++it )
@@ -124,4 +127,22 @@
   }
 
+  std::string LANDiscovery::getServerListItemRTT(unsigned int index)
+  {
+    if( index >= this->servers_.size() )
+      return BLANKSTRING;
+    else{
+      uint32_t serverrtt = this->servers_[index].getServerRTT();
+      return Ogre::StringConverter::toString(serverrtt);
+    }
+  }
 
+  std::string LANDiscovery::getServerListItemPlayerNumber(unsigned int index)
+  {
+    if( index >= this->servers_.size() )
+      return BLANKSTRING;
+    else{
+      int playerNumber = this->servers_[index].getClientNumber();
+      return Ogre::StringConverter::toString(playerNumber);
+    }
+  }
 } // namespace orxonox
Index: code/trunk/src/libraries/network/LANDiscovery.h
===================================================================
--- code/trunk/src/libraries/network/LANDiscovery.h	(revision 9667)
+++ code/trunk/src/libraries/network/LANDiscovery.h	(revision 10622)
@@ -33,4 +33,5 @@
 #include "packet/ServerInformation.h"
 #include "util/Singleton.h"
+#include <OgreStringConverter.h>
 
 #include <vector>
@@ -51,6 +52,8 @@
       std::string getServerListItemName( unsigned int index ); // tolua_export
       std::string getServerListItemIP( unsigned int index ); // tolua_export
+      std::string getServerListItemRTT( unsigned int index ); // tolua_export
+      std::string getServerListItemPlayerNumber( unsigned int index ); // tolua_export
       static LANDiscovery& getInstance(){ return Singleton<LANDiscovery>::getInstance(); } // tolua_export
-      
+
     private:
       static LANDiscovery* singletonPtr_s;
Index: code/trunk/src/libraries/network/MasterServer.cc
===================================================================
--- code/trunk/src/libraries/network/MasterServer.cc	(revision 9667)
+++ code/trunk/src/libraries/network/MasterServer.cc	(revision 10622)
@@ -34,5 +34,5 @@
 #include "util/Output.h"
 
-namespace orxonox 
+namespace orxonox
 {
   /*** MACROS ***/
@@ -45,9 +45,6 @@
   MasterServer *MasterServer::instance = NULL;
 
-
-
-
   /* command: list servers */
-  void 
+  void
   MasterServer::listServers( void )
   {
@@ -59,6 +56,6 @@
 
     /* loop through list elements */
-    for( i = MasterServer::getInstance()->mainlist.serverlist.begin(); 
-      i != MasterServer::getInstance()->mainlist.serverlist.end(); ++i ) 
+    for( i = MasterServer::getInstance()->mainlist.serverlist.begin();
+      i != MasterServer::getInstance()->mainlist.serverlist.end(); ++i )
     {
       orxout(user_info) << "  " << (*i).ServerInfo.getServerIP() << std::endl;
@@ -70,13 +67,13 @@
   }
 
-  void 
+  void
   MasterServer::delServer( std::string todeladdr )
   {
     /* tell the user we're now removing the entry from the server list */
-    orxout(user_info) << "MS: Deleting server \"" << todeladdr << "\"..." 
+    orxout(user_info) << "MS: Deleting server \"" << todeladdr << "\"..."
       << std::endl;
 
     /* see if we actually have that server on our list */
-    ServerListSearchResult shandle = 
+    ServerListSearchResult shandle =
       MasterServer::getInstance()->mainlist.findServerByAddress(todeladdr);
 
@@ -86,5 +83,5 @@
     }
 
-    /* force-disconnect the server */  
+    /* force-disconnect the server */
     enet_peer_disconnect( shandle.result.peer, 0 );
 
@@ -98,14 +95,14 @@
 
   /* helpers */
-  static void 
+  static void
   helper_output_debug( ENetEvent *event, char *addrconv )
   {
     orxout(verbose, context::master_server)
-      << "A packet of length" 
+      << "A packet of length"
       << event->packet->dataLength
       << " containing "
       << (const char*)event->packet->data
       << " was received from "
-      << addrconv 
+      << addrconv
       << " on channel "
       << event->channelID << endl;
@@ -122,21 +119,21 @@
 
     /* loop through list elements */
-    for( i = mainlist.serverlist.begin(); i 
-        != mainlist.serverlist.end(); ++i ) 
+    for( i = mainlist.serverlist.begin(); i
+        != mainlist.serverlist.end(); ++i )
     {
       /* send this particular server */
       /* build reply string */
-      char *tosend = (char *)calloc( (*i).ServerInfo.getServerIP().length() 
-          + MSPROTO_SERVERLIST_ITEM_LEN + 2,1 );
-      if( !tosend ) 
+      int packetlen = MSPROTO_SERVERLIST_ITEM_LEN + 1 + (*i).ServerInfo.getServerIP().length() + 1 + (*i).ServerInfo.getServerName().length() + 1 + sizeof((*i).ServerInfo.getClientNumber()) + 1;
+      char *tosend = (char *)calloc(packetlen ,1 );
+      if( !tosend )
       { orxout(internal_warning, context::master_server) << "Masterserver.cc: Memory allocation failed." << endl;
         continue;
-      } 
-      sprintf( tosend, "%s %s", MSPROTO_SERVERLIST_ITEM, 
-          (*i).ServerInfo.getServerIP().c_str() );
+      }
+      sprintf( tosend, "%s %s %s %u", MSPROTO_SERVERLIST_ITEM,
+          (*i).ServerInfo.getServerIP().c_str(), (*i).ServerInfo.getServerName().c_str(), (*i).ServerInfo.getClientNumber());
 
       /* create packet from it */
       reply = enet_packet_create( tosend,
-          strlen( tosend ) + 1, 
+          strlen( tosend ) + 1,
           ENET_PACKET_FLAG_RELIABLE);
 
@@ -149,5 +146,5 @@
       /* free the tosend buffer */
       free( tosend );
-    } 
+    }
 
     /* create end-of-list packet */
@@ -163,25 +160,25 @@
   }
 
-  /* maybe the two methods below can be merged into one and 
-   * made to use ENet's RTT functionality to check for disconnected 
+  /* maybe the two methods below can be merged into one and
+   * made to use ENet's RTT functionality to check for disconnected
    * servers.
    */
-  void 
+  void
   MasterServer::helper_cleanupServers( void )
   {
     /* get an iterator */
     std::list<ServerListElem>::iterator i;
-     
+
     if( mainlist.serverlist.size() == 0 )
       return;
 
     /* loop through list elements */
-    for( i = mainlist.serverlist.begin(); i 
-        != mainlist.serverlist.end(); ++i ) 
+    for( i = mainlist.serverlist.begin(); i
+        != mainlist.serverlist.end(); ++i )
     { /* see if we have a disconnected peer */
-      if( (*i).peer && 
+      if( (*i).peer &&
          ((*i).peer->state == ENET_PEER_STATE_DISCONNECTED ||
           (*i).peer->state == ENET_PEER_STATE_ZOMBIE ))
-      { 
+      {
         /* Remove it from the list */
         orxout(internal_warning) << (char*)(*i).peer->data << " timed out.\n";
@@ -190,5 +187,5 @@
         /* stop iterating, we manipulated the list */
         /* TODO note: this only removes one dead server per loop
-         * iteration. not beautiful, but one iteration is ~100ms, 
+         * iteration. not beautiful, but one iteration is ~100ms,
          * so not really relevant for the moment.
          */
@@ -196,5 +193,5 @@
       }
     }
- 
+
   }
 
@@ -204,5 +201,5 @@
   /***** EVENTS *****/
   /* connect event */
-  int 
+  int
   MasterServer::eventConnect( ENetEvent *event )
   { /* check for bad parameters */
@@ -217,11 +214,11 @@
 
     /* output debug info */
-    orxout(verbose, context::master_server) << "A new client connected from " 
-      << addrconv 
-      << " on port " 
+    orxout(verbose, context::master_server) << "A new client connected from "
+      << addrconv
+      << " on port "
       << event->peer->address.port << endl;
 
     /* store string form of address here */
-    event->peer->data = addrconv; 
+    event->peer->data = addrconv;
 
     /* all fine. */
@@ -230,5 +227,5 @@
 
   /* disconnect event */
-  int 
+  int
   MasterServer::eventDisconnect( ENetEvent *event )
   { /* check for bad parameters */
@@ -255,5 +252,5 @@
 
   /* data event */
-  int 
+  int
   MasterServer::eventData( ENetEvent *event )
   { /* validate packet */
@@ -262,8 +259,15 @@
       return -1;
     }
-     
+
     /* generate address in readable form */
     char *addrconv = (char *) calloc( 50, 1 );
     enet_address_get_host_ip( &(event->peer->address), addrconv, 49 );
+    /* convert to string */
+    std::string ip = std::string( addrconv );
+    /* delete addrconv */
+    if( addrconv ) free( addrconv );
+
+    /* pointer to full packet data */
+    char * packetdata = (char *)event->packet->data;
 
     /* output debug info about the data that has come */
@@ -271,49 +275,61 @@
 
     /* GAME SERVER OR CLIENT CONNECTION? */
-    if( !strncmp( (char *)event->packet->data, MSPROTO_GAME_SERVER, 
-      MSPROTO_GAME_SERVER_LEN ) )
+    if( !strncmp(packetdata, MSPROTO_GAME_SERVER, MSPROTO_GAME_SERVER_LEN ) )
     { /* Game server */
 
-      if( !strncmp( (char *)event->packet->data 
-        + MSPROTO_GAME_SERVER_LEN+1, 
-        MSPROTO_REGISTER_SERVER, MSPROTO_REGISTER_SERVER_LEN ) )
+      if( !strncmp( packetdata + MSPROTO_GAME_SERVER_LEN+1, MSPROTO_REGISTER_SERVER, MSPROTO_REGISTER_SERVER_LEN ) )
       { /* register new server */
-        mainlist.addServer( packet::ServerInformation( event ),
-          event->peer );
-        
+        mainlist.addServer( packet::ServerInformation( event ), event->peer );
+
         /* tell people we did so */
-        orxout(internal_info, context::master_server) << "Added new server to list: " << 
+        orxout(internal_info, context::master_server) << "Added new server to list: " <<
           packet::ServerInformation( event ).getServerIP() << endl;
       }
 
-      else if( !strncmp( (char *)event->packet->data
-        + MSPROTO_GAME_SERVER_LEN+1,
-        MSPROTO_SERVERDC, MSPROTO_SERVERDC_LEN ) )
-      {
+      else if( !strncmp( packetdata + MSPROTO_GAME_SERVER_LEN+1, MSPROTO_SERVERDC, MSPROTO_SERVERDC_LEN ) )
+      { /* disconnect server */
+
+        /* remove the server from the list it belongs to */
+        this->mainlist.delServerByAddress( ip );
+
+        /* tell the user */
+        orxout(internal_info, context::master_server) << "Removed server " << ip << " from list." << endl;
+      }
+      /* TODO add hook for disconnect here */
+
+      else if( !strncmp( packetdata + MSPROTO_GAME_SERVER_LEN+1, MSPROTO_SET_NAME, MSPROTO_SET_NAME_LEN ) )
+      { /* save server name */
         /* create string from peer data */
-        std::string name = std::string( addrconv );
+        std::string data (event->packet->data,event->packet->data + event->packet->dataLength );
+        std::string name = data.substr(MSPROTO_GAME_SERVER_LEN+1 + MSPROTO_SET_NAME_LEN + 1);
 
         /* remove the server from the list it belongs to */
-        this->mainlist.delServerByAddress( name );
+        this->mainlist.setNameByAddress( ip, name );
 
         /* tell the user */
-        orxout(internal_info, context::master_server) << "Removed server " << name << " from list." << endl;
-      }
-
-      /* TODO add hook for disconnect here */
-    }
-    else if( !strncmp( (char *)event->packet->data, MSPROTO_CLIENT, 
-      MSPROTO_CLIENT_LEN) )
+        orxout(internal_info, context::master_server) << "Updated server " << ip << " with new name " << name << endl;
+      }
+
+      else if( !strncmp( packetdata + MSPROTO_GAME_SERVER_LEN+1, MSPROTO_SET_CLIENTS, MSPROTO_SET_CLIENTS_LEN ) )
+      { /* save client count from server */
+        /* create string from peer data */
+        std::string data (event->packet->data,event->packet->data + event->packet->dataLength );
+        std::string textform= data.substr(MSPROTO_GAME_SERVER_LEN + 1 + MSPROTO_SET_CLIENTS_LEN + 1);
+        int clientNumber = Ogre::StringConverter::parseInt(textform);
+
+        this->mainlist.setClientsByAddress( ip, clientNumber);
+
+        /* tell the user */
+        orxout(internal_info, context::master_server) << "Updated server " << ip << " with new client number " << clientNumber << endl;
+      }
+    }
+    else if( !strncmp( packetdata, MSPROTO_CLIENT, MSPROTO_CLIENT_LEN) )
     { /* client */
-      if( !strncmp( (char *)event->packet->data + MSPROTO_CLIENT_LEN+1,
-        MSPROTO_REQ_LIST, MSPROTO_REQ_LIST_LEN ) )
+      if( !strncmp( packetdata + MSPROTO_CLIENT_LEN+1, MSPROTO_REQ_LIST, MSPROTO_REQ_LIST_LEN ) )
         /* send server list */
         helper_sendlist( event );
     }
     else
-    { /* bad message, don't do anything. */ } 
-
-    /* delete addrconv */
-    if( addrconv ) free( addrconv );
+    { /* bad message, don't do anything. */ }
 
     /* Clean up the packet now that we're done using it. */
@@ -324,5 +340,5 @@
 
   /**** MAIN ROUTINE *****/
-  int 
+  int
   MasterServer::run()
   {
@@ -330,5 +346,5 @@
     ENetEvent *event = (ENetEvent *)calloc(sizeof(ENetEvent), sizeof(char));
     if( event == NULL )
-    { 
+    {
       orxout(user_error, context::master_server) << "Could not create ENetEvent structure, exiting." << endl;
       exit( EXIT_FAILURE );
@@ -345,9 +361,9 @@
     switch (event->type)
     { /* new connection */
-      case ENET_EVENT_TYPE_CONNECT: 
+      case ENET_EVENT_TYPE_CONNECT:
         eventConnect( event ); break;
 
         /* disconnect */
-      case ENET_EVENT_TYPE_DISCONNECT: 
+      case ENET_EVENT_TYPE_DISCONNECT:
         eventDisconnect( event ); break;
 
@@ -358,6 +374,7 @@
 
     /* done */
+    free(event);
     return 0;
-  } 
+  }
 
   /* constructor */
@@ -380,7 +397,7 @@
     this->address.port = ORX_MSERVER_PORT;
 
-    /* create a host with the above settings (the last two 0 mean: accept 
+    /* create a host with the above settings (the last two 0 mean: accept
      * any input/output bandwidth */
-    this->server = enet_host_create( &this->address, ORX_MSERVER_MAXCONNS, 
+    this->server = enet_host_create( &this->address, ORX_MSERVER_MAXCONNS,
         ORX_MSERVER_MAXCHANS, 0, 0 );
     assert(this->server);
@@ -388,5 +405,5 @@
     /* see if creation worked */
     if( !this->server )
-    { orxout(user_error, context::master_server) << 
+    { orxout(user_error, context::master_server) <<
         "An error occurred while trying to create an ENet server host." << endl;
       exit( EXIT_FAILURE );
Index: code/trunk/src/libraries/network/MasterServer.h
===================================================================
--- code/trunk/src/libraries/network/MasterServer.h	(revision 9667)
+++ code/trunk/src/libraries/network/MasterServer.h	(revision 10622)
@@ -49,5 +49,8 @@
 #include <cstdio>
 
-namespace orxonox 
+#include <OgreStringConverter.h>
+
+
+namespace orxonox
 {
   /* singleton */
@@ -63,9 +66,9 @@
       /* static pointer for commands */
       static MasterServer *instance;
-      static MasterServer *getInstance() 
+      static MasterServer *getInstance()
         { return instance; }
-      static void setInstance( MasterServer *setto ) 
+      static void setInstance( MasterServer *setto )
         { instance = setto;  }
-      
+
       /* functions for commands */
       static void listServers( void );
Index: code/trunk/src/libraries/network/MasterServerProtocol.h
===================================================================
--- code/trunk/src/libraries/network/MasterServerProtocol.h	(revision 9667)
+++ code/trunk/src/libraries/network/MasterServerProtocol.h	(revision 10622)
@@ -37,11 +37,9 @@
 /* Client token (shows that the party sending data is a client */
 #define MSPROTO_CLIENT "CL"
-#define MSPROTO_CLIENT_LEN 2 
+#define MSPROTO_CLIENT_LEN 2
 
 /* Request: Serverlist (requiest made from client to master server */
 #define MSPROTO_REQ_LIST "REQ:LIST"
 #define MSPROTO_REQ_LIST_LEN 8
-
-
 
 
@@ -67,5 +65,5 @@
 /* ping request from server */
 #define MSPROTO_PING_GAMESERVER "PING"
-#define MSPROTO_PING_GAMESERVER_LEN 4 
+#define MSPROTO_PING_GAMESERVER_LEN 4
 
 /* server disconnect */
@@ -75,7 +73,15 @@
 /* ping reply */
 #define MSPROTO_ACK "ACK"
-#define MSPROTO_ACK_LEN 3 
+#define MSPROTO_ACK_LEN 3
 
+/* server name */
+#define MSPROTO_SET_NAME "NAM"
+#define MSPROTO_SET_NAME_LEN 3
 
+/* server number of clients */
+#define MSPROTO_SET_CLIENTS "CLI"
+#define MSPROTO_SET_CLIENTS_LEN 3
+
+#define SERVER_NAME_MAXLEN 7
 
 /* default master server port */
Index: code/trunk/src/libraries/network/PeerList.cc
===================================================================
--- code/trunk/src/libraries/network/PeerList.cc	(revision 9667)
+++ code/trunk/src/libraries/network/PeerList.cc	(revision 10622)
@@ -38,8 +38,8 @@
   PeerList::~PeerList() { }
 
-  int 
+  int
   PeerList::addPeer( ENetPeer *toadd )
   { /* error correction */
-    if( toadd == NULL ) 
+    if( toadd == NULL )
     { orxout(internal_error, context::master_server) << "PeerList::addPeer: empty peer given." << endl;
       return -1;
@@ -52,5 +52,5 @@
 
   bool sub_compAddr( ENetAddress addr1, ENetAddress addr2 )
-  { 
+  {
     for( int i = 0; i < 16; ++i )
       if( addr1.host.addr[i] < addr2.host.addr[i] )
@@ -61,5 +61,5 @@
     return 0;
   }
-    
+
 
   bool
@@ -69,5 +69,5 @@
 
     /* loop through list elements */
-    for( i = peerlist.begin(); i != peerlist.end(); ++i ) 
+    for( i = peerlist.begin(); i != peerlist.end(); ++i )
       if( !sub_compAddr((*i)->address, addr ) )
       { /* found this name, remove and quit */
@@ -86,5 +86,5 @@
 
     /* loop through list elements */
-    for( i = peerlist.begin(); i != peerlist.end(); ++i ) 
+    for( i = peerlist.begin(); i != peerlist.end(); ++i )
       if( !sub_compAddr((*i)->address, addr ) )
         /* found this name, remove and quit */
@@ -95,4 +95,8 @@
   }
 
+  int
+  PeerList::count(){
+    return this->peerlist.size();
+  }
+
 }
-
Index: code/trunk/src/libraries/network/PeerList.h
===================================================================
--- code/trunk/src/libraries/network/PeerList.h	(revision 9667)
+++ code/trunk/src/libraries/network/PeerList.h	(revision 10622)
@@ -35,10 +35,10 @@
 
 /* peer list */
-namespace orxonox 
+namespace orxonox
 {
-  /** This class keeps a list of open connections 
+  /** This class keeps a list of open connections
    * and some info about them.
    */
-  class PeerList 
+  class PeerList
   { public:
       /** constructor */
@@ -50,6 +50,6 @@
       /** \param toadd The peer to add
        * \return 0 for success, -1 for error.
-       * 
-       * Add new peer to list 
+       *
+       * Add new peer to list
        */
       int addPeer( ENetPeer *toadd );
@@ -57,15 +57,21 @@
       /** \param addr Address to look for
        * \return if the peer was found or not
-       * 
-       * Remove peer from list by address 
+       *
+       * Remove peer from list by address
        */
       bool remPeerByAddr( ENetAddress addr );
 
       /** \param addr The address to find by
-       * 
-       * Find a connection by address */
+       *
+       * Find a connection by address
+       */
       ENetPeer *findPeerByAddr( ENetAddress addr );
 
-      /* NOTE: making this list public so it can easily 
+      /**
+       * Count current peers
+       */
+       int count();
+
+      /* NOTE: making this list public so it can easily
        * be iterated. This makes sense since iterating it
        * will happen all the time, and using getter methods
Index: code/trunk/src/libraries/network/Server.cc
===================================================================
--- code/trunk/src/libraries/network/Server.cc	(revision 9667)
+++ code/trunk/src/libraries/network/Server.cc	(revision 10622)
@@ -77,5 +77,11 @@
     this->timeSinceLastUpdate_=0;
   }
-
+/*
+  Server::Server(int port, const std::string name)
+  {
+    this->setPort( port );
+    this->timeSinceLastUpdate_=0;
+    this->serverName_=name;
+  }*/
   /**
   * Constructor
@@ -108,7 +114,9 @@
     /* make discoverable on LAN */
     LANDiscoverable::setActivity(true);
+    LANDiscoverable::updateClientNumber(0);
 
     /* make discoverable on WAN */
     WANDiscoverable::setActivity(true);
+    WANDiscoverable::updateClientNumber(0);
 
     /* done */
@@ -283,4 +291,7 @@
     // inform all the listeners
     this->clientIDs_.push_back(peerID);
+    WANDiscoverable::updateClientNumber(this->clientIDs_.size());
+    LANDiscoverable::updateClientNumber(this->clientIDs_.size());
+
     ClientConnectionListener::broadcastClientConnected(peerID);
     GamestateManager::addPeer(peerID);
@@ -289,4 +300,5 @@
 
     orxout(internal_info, context::network) << "Server: added client id: " << peerID << endl;
+
     createClient(peerID);
 }
@@ -309,4 +321,7 @@
     }
   }
+  WANDiscoverable::updateClientNumber(this->clientIDs_.size());
+  LANDiscoverable::updateClientNumber(this->clientIDs_.size());
+
   ClientConnectionListener::broadcastClientDisconnected(peerID);
   GamestateManager::removePeer(peerID);
Index: code/trunk/src/libraries/network/Server.h
===================================================================
--- code/trunk/src/libraries/network/Server.h	(revision 9667)
+++ code/trunk/src/libraries/network/Server.h	(revision 10622)
@@ -67,4 +67,7 @@
     virtual void printRTT();
     float getPacketLoss(unsigned int clientID);
+    int getClientCount() { return this->clientIDs_.size();}
+    std::string getServerName() { return this->serverName_;}
+
   protected:
     void updateGamestate();
@@ -89,4 +92,5 @@
     std::deque<packet::Packet*> packetQueue_;
     std::vector<uint32_t>       clientIDs_;
+    std::string                 serverName_;
   };
 
Index: code/trunk/src/libraries/network/ServerList.cc
===================================================================
--- code/trunk/src/libraries/network/ServerList.cc	(revision 9667)
+++ code/trunk/src/libraries/network/ServerList.cc	(revision 10622)
@@ -30,5 +30,5 @@
 
 namespace orxonox
-{ 
+{
   ServerList::ServerList()
   { /* create a new list */ }
@@ -39,24 +39,24 @@
   }
 
-  int 
+  int
   ServerList::addServer( packet::ServerInformation toadd,
     ENetPeer *peer )
-  { 
+  {
     ServerListElem toAdd;
     toAdd.ServerInfo = toadd;
     toAdd.peer = peer;
 
-    this->serverlist.push_back( toAdd ); 
+    this->serverlist.push_back( toAdd );
     return 0;
   }
 
-  bool 
+  bool
   ServerList::delServerByName( std::string name )
-  { 
+  {
     /* get an iterator */
     std::list<ServerListElem>::iterator i;
 
     /* loop through list elements */
-    for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
+    for( i = serverlist.begin(); i != serverlist.end(); ++i )
       if( (*i).ServerInfo.getServerName() == name )
       { /* found this name, remove and quit */
@@ -68,10 +68,10 @@
 
   bool ServerList::delServerByAddress( std::string address )
-  { 
+  {
     /* get an iterator */
     std::list<ServerListElem>::iterator i;
 
     /* loop through list elements */
-    for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
+    for( i = serverlist.begin(); i != serverlist.end(); ++i )
       if( (*i).ServerInfo.getServerIP() == address )
       { /* found this name, remove and quit */
@@ -90,5 +90,5 @@
 
     /* loop through list elements */
-    for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
+    for( i = serverlist.begin(); i != serverlist.end(); ++i )
       if( (*i).ServerInfo.getServerIP() == address )
       { /* found the target, return it */
@@ -110,7 +110,7 @@
     /* iterate, return when name found */
     /* loop through list elements */
-    for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
+    for( i = serverlist.begin(); i != serverlist.end(); ++i )
       if( (*i).ServerInfo.getServerName() == name )
-      { 
+      {
         ServerListSearchResult res = { (*i), true };
         return res;
@@ -124,24 +124,52 @@
   /* SORTING */
   /* sort by name */
-  bool sub_compare_names( ServerListElem no1, 
+  bool sub_compare_names( ServerListElem no1,
     ServerListElem no2 )
   { return no1.ServerInfo.getServerName() > no2.ServerInfo.getServerName(); }
 
   void ServerList::sortByName()
-  { 
-    this->serverlist.sort( sub_compare_names ); 
+  {
+    this->serverlist.sort( sub_compare_names );
   }
-  
+
   /* sort by ping */
-  bool sub_compare_pings( ServerListElem no1, 
+  bool sub_compare_pings( ServerListElem no1,
     ServerListElem no2 )
-  { 
-    return no1.ServerInfo.getServerName() > no2.ServerInfo.getServerName();
+  {
+    return no1.ServerInfo.getServerRTT() > no2.ServerInfo.getServerRTT();
   }
 
   void ServerList::sortByPing()
   {
-    this->serverlist.sort( sub_compare_pings ); 
+    this->serverlist.sort( sub_compare_pings );
   }
 
+  bool ServerList::setNameByAddress( std::string address, std::string name  ){
+    /* get an iterator */
+    std::list<ServerListElem>::iterator i;
+
+    /* loop through list elements */
+    for( i = serverlist.begin(); i != serverlist.end(); ++i )
+      if( (*i).ServerInfo.getServerIP() == address )
+      { /* found this adress, rename and quit */
+        (*i).ServerInfo.setServerName( name );
+        return true;
+      }
+    return false;
+  };
+
+  bool ServerList::setClientsByAddress( std::string address, int clientNumber ){
+    /* get an iterator */
+    std::list<ServerListElem>::iterator i;
+
+    /* loop through list elements */
+    for( i = serverlist.begin(); i != serverlist.end(); ++i )
+      if( (*i).ServerInfo.getServerIP() == address )
+      { /* found this adress, rename and quit */
+        (*i).ServerInfo.setClientNumber( clientNumber );
+        return true;
+      }
+    return false;
+  };
+
 }
Index: code/trunk/src/libraries/network/ServerList.h
===================================================================
--- code/trunk/src/libraries/network/ServerList.h	(revision 9667)
+++ code/trunk/src/libraries/network/ServerList.h	(revision 10622)
@@ -35,8 +35,8 @@
 
 /* methods necessary */
-namespace orxonox 
-{ 
+namespace orxonox
+{
   /* HELPER STRUCTURES */
-  struct ServerListElem 
+  struct ServerListElem
   {
     /* server information (name, IP, etc) */
@@ -63,5 +63,5 @@
    * and some info about them.
    */
-  class ServerList 
+  class ServerList
   { public:
       /** constructor */
@@ -74,5 +74,5 @@
       /* BASIC MANIPULATION */
       /** \param toadd the server to add.
-       * 
+       *
        * Add server to the game server list
        */
@@ -81,24 +81,25 @@
 
       /** \param name Name of the server to remove
-       * 
-       * Remove server by name 
+       *
+       * Remove server by name
        */
       bool delServerByName( std::string name );
 
       /** \param address IP address of the server to remove
-       * 
+       *
        * Remove server by address
        */
       bool delServerByAddress( std::string address );
 
+      bool setNameByAddress( std::string address, std::string name  );
 
-
+      bool setClientsByAddress( std::string address, int clientNumber );
 
       /* SEARCHING */
-      /* \param address The address of the server that is to be 
+      /* \param address The address of the server that is to be
        *  found
        * \return A struct containing a result of the search and a boolean
        *  that is only true if the search was successful
-       * 
+       *
        * Find and return the list handle of a given address.
        */
@@ -107,8 +108,8 @@
 
 
-      /* \param name The name of the server that is to be 
+      /* \param name The name of the server that is to be
        *  found
        * \return The struct containing the list entry of the server
-       * 
+       *
        * Find and return the list handle of a given name.
        */
@@ -120,5 +121,5 @@
       /** sort by name  */
       void sortByName();
-      
+
       /** sort by ping */
       void sortByPing();
Index: code/trunk/src/libraries/network/WANDiscoverable.cc
===================================================================
--- code/trunk/src/libraries/network/WANDiscoverable.cc	(revision 9667)
+++ code/trunk/src/libraries/network/WANDiscoverable.cc	(revision 10622)
@@ -44,5 +44,5 @@
     /* debugging output */
     orxout(verbose, context::master_server) << "Creating WANDiscoverable." << endl;
-  
+
     /* register object in orxonox */
     RegisterObject(WANDiscoverable);
@@ -50,15 +50,15 @@
     /* check for the masterserver address option in orxonox.ini */
     this->setConfigValues();
-    
+
   }
 
   void WANDiscoverable::setConfigValues()
   {
-    /* update msaddress string from orxonox.ini config file, if it 
-     * has changed. 
+    /* update msaddress string from orxonox.ini config file, if it
+     * has changed.
      */
-    SetConfigValueExternal(msaddress, "WANDiscovery", "msaddress", "orxonox.net");
-//     SetConfigValue( msaddress, "orxonox.net");
-  } 
+    SetConfigValueExternal(msaddress, "Discovery", "msaddress", "orxonox.net");
+    SetConfigValueExternal(ownName, "Discovery", "ownName", "OrxServer");
+  }
 
   WANDiscoverable::~WANDiscoverable()
@@ -67,10 +67,10 @@
       this->disconnect();
   }
-  
+
   void WANDiscoverable::setActivity(bool bActive)
   {
     if( bActive==this->bActive_ )
       return;
-    
+
     if( bActive )
     {
@@ -84,5 +84,5 @@
     }
   }
-  
+
   bool WANDiscoverable::connect()
   {
@@ -93,20 +93,23 @@
       return false;
     }
-    
+
     /* connect and see if it worked */
     if( msc.connect( this->msaddress.c_str(), ORX_MSERVER_PORT ) )
     {
-      orxout(internal_error, context::master_server) << "Could not connect to master server at " 
+      orxout(internal_error, context::master_server) << "Could not connect to master server at "
                  << this->msaddress << endl;
       return false;
     }
-                 
+
     /* debugging output */
     orxout(verbose, context::master_server) << "Initialization of WANDiscoverable complete." << endl;
-    
-    
+
     // Now register the server at the master server
     this->msc.sendRequest( MSPROTO_GAME_SERVER " " MSPROTO_REGISTER_SERVER );
-    
+
+    std::string request = MSPROTO_GAME_SERVER " " MSPROTO_SET_NAME " ";
+    request += this->ownName;
+    this->msc.sendRequest( request );
+
     return true;
   }
@@ -118,6 +121,15 @@
   }
 
+  void WANDiscoverable::updateClientNumber(int clientNumber)
+  {
+    orxout(verbose, context::master_server) << "Sending new number of clients: " << clientNumber << endl;
+    std::string request = MSPROTO_GAME_SERVER " " MSPROTO_SET_CLIENTS " ";
+    request += Ogre::StringConverter::toString(clientNumber);
+
+    this->msc.sendRequest( request );
+  }
 
 
-  
+
+
 } // namespace orxonox
Index: code/trunk/src/libraries/network/WANDiscoverable.h
===================================================================
--- code/trunk/src/libraries/network/WANDiscoverable.h	(revision 9667)
+++ code/trunk/src/libraries/network/WANDiscoverable.h	(revision 10622)
@@ -32,4 +32,5 @@
 #include "core/config/Configurable.h"
 #include "MasterServerComm.h"
+#include <OgreStringConverter.h>
 
 namespace orxonox
@@ -46,6 +47,6 @@
 
       /** \return Address of the master server
-       * 
-       * Get the master server address 
+       *
+       * Get the master server address
        */
       std::string getMSAddress()
@@ -54,20 +55,23 @@
       /** Function used for the configuration file parameter update */
       void setConfigValues();
-      
+
       /** Function used to set the activity/discoverability */
       void setActivity( bool bActive );
 
+      void updateClientNumber(int clientNumber);
+
       /** Master server communications object */
       MasterServerComm msc;
-      
+
     private:
       /** Function used to connect to the master server */
       bool connect();
-      
+
       /** Function used to disconnect from the master server */
       void disconnect();
-      
+
       /** master server address */
       std::string msaddress;
+      std::string ownName;
       bool        bActive_;
 
Index: code/trunk/src/libraries/network/WANDiscovery.cc
===================================================================
--- code/trunk/src/libraries/network/WANDiscovery.cc	(revision 9667)
+++ code/trunk/src/libraries/network/WANDiscovery.cc	(revision 10622)
@@ -41,5 +41,5 @@
     /* debugging output */
     orxout(verbose, context::master_server) << "Creating WANDiscovery." << endl;
-  
+
     /* register object in orxonox */
     RegisterObject(WANDiscovery);
@@ -54,5 +54,5 @@
     /* connect and see if it worked */
     if( msc.connect( this->msaddress.c_str(), ORX_MSERVER_PORT ) )
-      orxout(internal_error, context::master_server) << "Could not connect to master server at " 
+      orxout(internal_error, context::master_server) << "Could not connect to master server at "
         << this->msaddress << endl;
 
@@ -63,19 +63,19 @@
   void WANDiscovery::setConfigValues()
   {
-    /* update msaddress string from orxonox.ini config file, if it 
-     * has changed. 
+    /* update msaddress string from orxonox.ini config file, if it
+     * has changed.
      */
     SetConfigValue( msaddress, "master.orxonox.net");
-  } 
+  }
 
   WANDiscovery::~WANDiscovery()
-  { 
+  {
     /* clear server list */
-    this->servers_.clear();  
+    this->servers_.clear();
   }
 
   /* callback for the network reply poller */
   int WANDiscovery::rhandler( char *addr, ENetEvent *ev )
-  { 
+  {
     /* error recognition */
     if( !ev || !ev->packet || !ev->packet->data )
@@ -88,13 +88,17 @@
     if( !strncmp( (char*)ev->packet->data, MSPROTO_SERVERLIST_ITEM,
       MSPROTO_SERVERLIST_ITEM_LEN ) )
-    { 
+    {
       /* create server structure from that item */
       packet::ServerInformation toadd;
 
       /* fill in data, -1 for the index: index should be length -1 */
-      toadd.setServerName( std::string((char*)ev->packet->data + 
-        MSPROTO_SERVERLIST_ITEM_LEN+1) );
-      toadd.setServerIP( std::string((char*)ev->packet->data + 
-        MSPROTO_SERVERLIST_ITEM_LEN+1) );
+      std::string datastr = std::string((char*)ev->packet->data + MSPROTO_SERVERLIST_ITEM_LEN+1);
+      int separator = datastr.find(" ");
+      toadd.setServerIP(datastr.substr(0,separator));
+      int secondsep = datastr.find(" ", separator + 1);
+      toadd.setServerName(datastr.substr(separator + 1, secondsep - separator - 1));
+      toadd.setClientNumber(Ogre::StringConverter::parseInt(datastr.substr(secondsep+1)));
+
+      orxout(internal_info, context::network) << "Received WAN discovery server information; Name: " << toadd.getServerName() << ", Address: " << toadd.getServerIP() << ", Players: " << toadd.getClientNumber() << ", RTT: " << toadd.getServerRTT() << endl;
 
       /* add to list */
@@ -103,10 +107,10 @@
     else if( !strncmp( (char*)ev->packet->data, MSPROTO_SERVERLIST_END,
       MSPROTO_SERVERLIST_END_LEN ) )
-    { 
+    {
       /* this is the only case where 2 should be returned,
        * as 1 is used to signal that we're done receiving
        * the list
        */
-      return 2; 
+      return 2;
     }
 
@@ -114,5 +118,5 @@
     return 1;
   }
- 
+
   void WANDiscovery::discover()
   {
@@ -131,5 +135,5 @@
       { case 0: /* no event occured, decrease timeout */
           --i; break;
-        case 1: /* got a list element, continue */ 
+        case 1: /* got a list element, continue */
           break;
         case 2: /* done. */
@@ -159,4 +163,23 @@
   }
 
+  std::string WANDiscovery::getServerListItemRTT(unsigned int index)
+  {
+    if( index >= this->servers_.size() )
+      return BLANKSTRING;
+    else{
+      uint32_t serverrtt = this->servers_[index].getServerRTT();
+      return Ogre::StringConverter::toString(serverrtt);
+    }
+
+  }
+  std::string WANDiscovery::getServerListItemPlayerNumber(unsigned int index)
+  {
+    if( index >= this->servers_.size() )
+      return BLANKSTRING;
+    else{
+      int playerNumber = this->servers_[index].getClientNumber();
+      return Ogre::StringConverter::toString(playerNumber);
+    }
+  }
 
 } // namespace orxonox
Index: code/trunk/src/libraries/network/WANDiscovery.h
===================================================================
--- code/trunk/src/libraries/network/WANDiscovery.h	(revision 9667)
+++ code/trunk/src/libraries/network/WANDiscovery.h	(revision 10622)
@@ -35,4 +35,5 @@
 #include "MasterServerComm.h"
 #include "MasterServerProtocol.h"
+#include <OgreStringConverter.h>
 
 #include <vector>
@@ -56,6 +57,6 @@
 
       /** \return Address of the master server
-       * 
-       * Get the master server address 
+       *
+       * Get the master server address
        */
       std::string getMSAddress()
@@ -65,20 +66,34 @@
       void discover(); // tolua_export
 
-      /** \param index Index to get the name of 
+      /** \param index Index to get the name of
        * \return The name of the server
-       * 
-       * Get the name of the server at index index. 
+       *
+       * Get the name of the server at index index.
        */
       std::string getServerListItemName( unsigned int index ); // tolua_export
 
-      /** \param index Index to get the IP of 
+      /** \param index Index to get the IP of
        * \return The IP of the server
-       * 
-       * Get the IP of the server at index index. 
+       *
+       * Get the IP of the server at index index.
        */
       std::string getServerListItemIP( unsigned int index ); // tolua_export
 
+      /** \param index Index to get the RTT of
+       * \return The RTT of the server
+       *
+       * Get the RTT of the server at index index.
+       */
+      std::string getServerListItemRTT( unsigned int index ); // tolua_export
+
+      /** \param index Index to get the RTT of
+       * \return The number of players on the server
+       *
+       * Get the number of players on the server
+       */
+      std::string getServerListItemPlayerNumber( unsigned int index ); // tolua_export
+
       /* todo: might make this private and use getter/setter methods
-       * at some later time. 
+       * at some later time.
        */
       /** game server list */
@@ -92,5 +107,5 @@
 
       int rhandler( char *addr, ENetEvent *ev );
-      
+
     private:
       /** master server address */
Index: code/trunk/src/libraries/network/packet/ServerInformation.cc
===================================================================
--- code/trunk/src/libraries/network/packet/ServerInformation.cc	(revision 9667)
+++ code/trunk/src/libraries/network/packet/ServerInformation.cc	(revision 10622)
@@ -39,10 +39,9 @@
   namespace packet
   {
-    
+
     ServerInformation::ServerInformation()
     {
-      
     }
-    
+
     ServerInformation::ServerInformation(ENetEvent* event)
     {
@@ -69,20 +68,21 @@
     ServerInformation::~ServerInformation()
     {
-      
+
     }
 
     void ServerInformation::send(ENetPeer* peer)
     {
-      uint32_t size = returnSize((char*&)LAN_DISCOVERY_ACK) + returnSize(this->serverName_);
+      std::string payload = this->serverName_ + Ogre::StringConverter::toString(this->clientNumber_);
+      uint32_t size = returnSize((char*&)LAN_DISCOVERY_ACK) + returnSize(payload);
       uint8_t* temp = new uint8_t[size];
       uint8_t* temp2 = temp;
       saveAndIncrease((char*&)LAN_DISCOVERY_ACK, temp2);
-      saveAndIncrease(this->serverName_, temp2);
+      saveAndIncrease(payload, temp2);
       ENetPacket* packet = enet_packet_create( temp, size, 0 );
       enet_peer_send(peer, 0, packet);
-      
+
       delete[] temp;
     }
-  
+
   } // namespace packet
 
@@ -95,3 +95,2 @@
   }
 } // namespace orxonox
-
Index: code/trunk/src/libraries/network/packet/ServerInformation.h
===================================================================
--- code/trunk/src/libraries/network/packet/ServerInformation.h	(revision 9667)
+++ code/trunk/src/libraries/network/packet/ServerInformation.h	(revision 10622)
@@ -30,4 +30,6 @@
 
 #include <string>
+#include <OgreStringConverter.h>
+
 
 #ifndef SERVERINFORMATION_H
@@ -45,14 +47,17 @@
         ServerInformation(ENetEvent* event);
         ~ServerInformation();
-        
+
         void          send( ENetPeer* peer );
+        void          setServerName(std::string name) { this->serverName_ = name; }
+        std::string   getServerName() { return this->serverName_; }
+        void          setServerIP( std::string IP ) { this->serverIP_ = IP; }
         std::string   getServerIP() { return this->serverIP_; }
-        std::string   getServerName() { return this->serverName_; }
-        void          setServerName(std::string name) { this->serverName_ = name; }
-        void          setServerIP( std::string IP ) { this->serverIP_ = IP; }
+        void          setClientNumber( int clientNumber ) { this->clientNumber_ = clientNumber; }
+        int           getClientNumber() { return this->clientNumber_; }
         uint32_t      getServerRTT() { return this->serverRTT_; }
-        
+
       private:
         std::string   serverName_;
+        int           clientNumber_;
         std::string   serverIP_;
         uint32_t      serverRTT_;
