当前位置: 首页>>代码示例>>C++>>正文


C++ ArClientBase::run方法代码示例

本文整理汇总了C++中ArClientBase::run方法的典型用法代码示例。如果您正苦于以下问题:C++ ArClientBase::run方法的具体用法?C++ ArClientBase::run怎么用?C++ ArClientBase::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArClientBase的用法示例。


在下文中一共展示了ArClientBase::run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv)
{
  Aria::init();
  ArGlobalFunctor1<ArNetPacket *> clientListHandlerCB(&clientListHandler);
  ArGlobalFunctor1<ArNetPacket *> clientAddedHandlerCB(&clientAddedHandler);
  ArGlobalFunctor1<ArNetPacket *> clientRemovedHandlerCB(&clientRemovedHandler);
  ArNetPacket packet;

  ArClientBase client;

  ArArgumentParser parser(&argc, argv);

  ArClientSimpleConnector clientConnector(&parser);

  parser.loadDefaultArguments();

  if (!Aria::parseArgs() || !parser.checkHelpAndWarnUnparsed())
  {
    Aria::logOptions();
    exit(0);
  }

  if (!clientConnector.connectClient(&client))
  {
    if (client.wasRejected())
      printf("Server '%s' rejected connection, exiting\n", client.getHost());
    else
      printf("Could not connect to server '%s', exiting\n", client.getHost());
    exit(1);
  } 

  printf("Connected to server.\n");

  client.addHandler("clientList", &clientListHandlerCB);
  client.requestOnce("clientList");
  client.addHandler("clientRemoved", &clientRemovedHandlerCB);
  client.request("clientRemoved", -1);
  client.addHandler("clientAdded", &clientAddedHandlerCB);
  client.request("clientAdded", -1);
  client.run();
  Aria::shutdown();
  return 0;
}
开发者ID:PipFall2015,项目名称:Ottos-Cloud,代码行数:43,代码来源:switchWatcher.cpp

示例2: main

int main(int argc, char **argv)
{

  ArGlobalFunctor1<ArNetPacket *> getMapNameCB(handleGetMapName);
  ArGlobalFunctor1<ArNetPacket *> getMapCB(handleGetMap);

  Aria::init();
  //ArLog::init(ArLog::StdOut, ArLog::Verbose);

  ArArgumentParser parser(&argc, argv);
	
  ArClientSimpleConnector clientConnector(&parser);

  parser.loadDefaultArguments();

  /* Check for -help, and unhandled arguments: */
  if (!Aria::parseArgs() || !parser.checkHelpAndWarnUnparsed())
  {
    Aria::logOptions();
    exit(0);
  }
  /* Connect our client object to the remote server: */
  if (!clientConnector.connectClient(&client))
  {
    exit(1);
  } 

  client.addHandler("getMap", &getMapCB);
  client.addHandler("getMapName", &getMapNameCB);
  client.requestOnce("getMapName");
  start.setToNow();
  client.requestOnce("getMap");

  client.run();

}
开发者ID:sanyaade-research-hub,项目名称:aria,代码行数:36,代码来源:mapClient.cpp


注:本文中的ArClientBase::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。