本文整理汇总了C++中HelloPrx::begin_sayHello方法的典型用法代码示例。如果您正苦于以下问题:C++ HelloPrx::begin_sayHello方法的具体用法?C++ HelloPrx::begin_sayHello怎么用?C++ HelloPrx::begin_sayHello使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HelloPrx
的用法示例。
在下文中一共展示了HelloPrx::begin_sayHello方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test
//.........这里部分代码省略.........
test(count == locator->getRequestCount());
communicator->stringToProxy("test")->ice_locatorCacheTimeout(-1)->ice_ping();
test(count == locator->getRequestCount());
communicator->stringToProxy("[email protected]")->ice_ping();
test(count == locator->getRequestCount());
communicator->stringToProxy("test")->ice_ping();
test(count == locator->getRequestCount());
test(communicator->stringToProxy("test")->ice_locatorCacheTimeout(99)->ice_getLocatorCacheTimeout() == 99);
cout << "ok" << endl;
cout << "testing proxy from server... " << flush;
obj = TestIntfPrx::checkedCast(communicator->stringToProxy("[email protected]"));
HelloPrx hello = obj->getHello();
test(hello->ice_getAdapterId() == "TestAdapter");
hello->sayHello();
hello = obj->getReplicatedHello();
test(hello->ice_getAdapterId() == "ReplicatedAdapter");
hello->sayHello();
cout << "ok" << endl;
cout << "testing locator request queuing... " << flush;
hello = obj->getReplicatedHello()->ice_locatorCacheTimeout(0)->ice_connectionCached(false);
count = locator->getRequestCount();
hello->ice_ping();
test(++count == locator->getRequestCount());
int i;
list<Ice::AsyncResultPtr> results;
AMICallbackPtr cb = new AMICallback;
for(i = 0; i < 1000; i++)
{
Ice::AsyncResultPtr result = hello->begin_sayHello(
newCallback_Hello_sayHello(cb, &AMICallback::response1, &AMICallback::exception1));
results.push_back(result);
}
while(!results.empty())
{
Ice::AsyncResultPtr result = results.front();
results.pop_front();
result->waitForCompleted();
}
test(locator->getRequestCount() > count && locator->getRequestCount() < count + 999);
if(locator->getRequestCount() > count + 800)
{
cout << "queuing = " << locator->getRequestCount() - count;
}
count = locator->getRequestCount();
hello = hello->ice_adapterId("unknown");
for(i = 0; i < 1000; i++)
{
Ice::AsyncResultPtr result = hello->begin_sayHello(
newCallback_Hello_sayHello(cb, &AMICallback::response2, &AMICallback::exception2));
results.push_back(result);
}
while(!results.empty())
{
Ice::AsyncResultPtr result = results.front();
results.pop_front();
result->waitForCompleted();
}
// Take into account the retries.
test(locator->getRequestCount() > count && locator->getRequestCount() < count + 1999);
if(locator->getRequestCount() > count + 800)
{
示例2: if
int
AsyncClient::run(int argc, char* argv[])
{
if(argc > 1)
{
cerr << appName() << ": too many arguments" << endl;
return EXIT_FAILURE;
}
HelloPrx hello = HelloPrx::checkedCast(communicator()->propertyToProxy("Hello.Proxy"));
if(!hello)
{
cerr << argv[0] << ": invalid proxy" << endl;
return EXIT_FAILURE;
}
menu();
CallbackPtr cb = new Callback();
char c;
do
{
try
{
cout << "==> ";
cin >> c;
if(c == 'i')
{
hello->sayHello(0);
}
else if(c == 'd')
{
hello->begin_sayHello(5000, newCallback_Hello_sayHello(cb, &Callback::response, &Callback::exception));
}
else if(c == 's')
{
hello->shutdown();
}
else if(c == 'x')
{
// Nothing to do
}
else if(c == '?')
{
menu();
}
else
{
cout << "unknown command `" << c << "'" << endl;
menu();
}
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
}
}
while(cin.good() && c != 'x');
return EXIT_SUCCESS;
}