本文整理汇总了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;
}
示例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();
}