示例#1
0
int CGameServer::ConnectToMasterServer()
{
  serverNet.Initialize(this, "serverNet");
  serverNet.CreateClient();
  
  const char* hostaddr = cfg_.masterIp_.c_str();
  int         hostport = cfg_.masterPort_;

  serverNet.Connect(hostaddr, hostport);
  
  r3dOutToLog("connecting to master server at %s:%d\n", hostaddr, hostport);

  float endWait = r3dGetTime() + 10.0f;
  while(1) 
  {
    serverNet.Update();
  
    if(serverNet.IsConnected()) {
      break;
    }
      
    if(r3dGetTime() > endWait) {
      r3dError("can't connect to %s:%d", hostaddr, hostport);
      return 0;
    }
  }
  
  r3dOutToLog("Connect to master server Ok\n");

  started_ = true;
  return 1;
}
示例#2
0
void CAdminUserServer::Tick()
{
	//r3dOutToLog("Update!\n");
	clientNet.Update();
}
示例#3
0
void CGameServer::Tick()
{
  serverNet.Update();
  
  return;
}