Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 10, 2010, 4:22:58 PM (14 years ago)
Author:
smerkli
Message:
 
Location:
code/branches/masterserver/src/libraries/network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/masterserver/src/libraries/network/Server.cc

    r7633 r7634  
    101101
    102102  /* TODO */
    103   void helper_ConnectToMasterserver()
    104   {
    105     /* TODO connect to master server here and say you're there */
     103  void Server::helper_ConnectToMasterserver()
     104  {
     105    /* initialize it and see if it worked */
     106    if( msc.initialize() )
     107      COUT(1) << "Error: could not initialize master server communications!\n";
     108
     109    /* connect and see if it worked */
     110    if( msc.connect( MS_ADDRESS, 1234 ) )
     111      COUT(1) << "Error: could not connect to master server!\n";
     112
     113    /* TODO */
     114    /* now send the master server some note we're here */
    106115  }
    107116
     
    154163
    155164
     165  /* TODO */
     166  int replyhandler( char *addr, ENetEvent *ev )
     167  {
     168    /* handle incoming data */
     169
     170    /* done handling, return all ok code 0 */
     171    return 0;
     172  }
     173
     174  void Server::helper_HandleMasterServerRequests()
     175  {
     176    this->msc.pollForReply( replyhandler );
     177  }
     178
    156179  /**
    157180  * Run this function once every tick
     
    167190    LANDiscoverable::update();
    168191
    169     // TODO receive and process requests from master server
     192    // receive and process requests from master server
     193    helper_HandleMasterServerRequests();
    170194
    171195    if ( ClientInformation::hasClients() )
  • code/branches/masterserver/src/libraries/network/Server.h

    r7163 r7634  
    3838#include "ServerConnection.h"
    3939#include "LANDiscoverable.h"
     40#include "MasterServerComm.h"
     41
     42/* proto (move to central point soon) */
     43#define MS_ADDRESS "localhost"
    4044
    4145namespace orxonox
     
    5357    ~Server();
    5458
     59    void helper_ConnectToMasterserver();
    5560    void open();
    5661    void close();
     
    8287
    8388    float timeSinceLastUpdate_;
     89    MasterServerComm msc;
    8490  };
    8591
Note: See TracChangeset for help on using the changeset viewer.