本文整理汇总了C++中HelloPrx::ice_oneway方法的典型用法代码示例。如果您正苦于以下问题:C++ HelloPrx::ice_oneway方法的具体用法?C++ HelloPrx::ice_oneway怎么用?C++ HelloPrx::ice_oneway使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HelloPrx
的用法示例。
在下文中一共展示了HelloPrx::ice_oneway方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
int
HelloClient::run(int argc, char* argv[])
{
if(argc > 1)
{
cerr << appName() << ": too many arguments" << endl;
return EXIT_FAILURE;
}
HelloPrx twoway = HelloPrx::checkedCast(
communicator()->propertyToProxy("Hello.Proxy")->ice_twoway()->ice_timeout(-1)->ice_secure(false));
if(!twoway)
{
cerr << argv[0] << ": invalid proxy" << endl;
return EXIT_FAILURE;
}
HelloPrx oneway = twoway->ice_oneway();
HelloPrx batchOneway = twoway->ice_batchOneway();
HelloPrx datagram = twoway->ice_datagram();
HelloPrx batchDatagram = twoway->ice_batchDatagram();
bool secure = false;
int timeout = -1;
int delay = 0;
menu();
char c;
do
{
try
{
cout << "==> ";
cin >> c;
if(c == 't')
{
twoway->sayHello(delay);
}
else if(c == 'o')
{
oneway->sayHello(delay);
}
else if(c == 'O')
{
batchOneway->sayHello(delay);
}
else if(c == 'd')
{
if(secure)
{
cout << "secure datagrams are not supported" << endl;
}
else
{
datagram->sayHello(delay);
}
}
else if(c == 'D')
{
if(secure)
{
cout << "secure datagrams are not supported" << endl;
}
else
{
batchDatagram->sayHello(delay);
}
}
else if(c == 'f')
{
communicator()->flushBatchRequests();
}
else if(c == 'T')
{
if(timeout == -1)
{
timeout = 2000;
}
else
{
timeout = -1;
}
twoway = twoway->ice_timeout(timeout);
oneway = oneway->ice_timeout(timeout);
batchOneway = batchOneway->ice_timeout(timeout);
if(timeout == -1)
{
cout << "timeout is now switched off" << endl;
}
else
{
cout << "timeout is now set to 2000ms" << endl;
}
}
else if(c == 'P')
{
if(delay == 0)
{
//.........这里部分代码省略.........