diff options
Diffstat (limited to 'cpp/demo/IceBox/hello/Client.cpp')
-rw-r--r-- | cpp/demo/IceBox/hello/Client.cpp | 190 |
1 files changed, 95 insertions, 95 deletions
diff --git a/cpp/demo/IceBox/hello/Client.cpp b/cpp/demo/IceBox/hello/Client.cpp index 279fd041c47..70fc21e6389 100644 --- a/cpp/demo/IceBox/hello/Client.cpp +++ b/cpp/demo/IceBox/hello/Client.cpp @@ -36,16 +36,16 @@ void HelloClient::menu() { cout << - "usage:\n" - "t: send greeting as twoway\n" - "o: send greeting as oneway\n" - "O: send greeting as batch oneway\n" - "d: send greeting as datagram\n" - "D: send greeting as batch datagram\n" - "f: flush all batch requests\n" - "S: switch secure mode on/off\n" - "x: exit\n" - "?: help\n"; + "usage:\n" + "t: send greeting as twoway\n" + "o: send greeting as oneway\n" + "O: send greeting as batch oneway\n" + "d: send greeting as datagram\n" + "D: send greeting as batch datagram\n" + "f: flush all batch requests\n" + "S: switch secure mode on/off\n" + "x: exit\n" + "?: help\n"; } int @@ -58,11 +58,11 @@ HelloClient::run(int argc, char* argv[]) callbackOnInterrupt(); HelloPrx twoway = HelloPrx::checkedCast( - communicator()->propertyToProxy("Hello.Proxy")->ice_twoway()->ice_timeout(-1)->ice_secure(false)); + communicator()->propertyToProxy("Hello.Proxy")->ice_twoway()->ice_timeout(-1)->ice_secure(false)); if(!twoway) { - cerr << argv[0] << ": invalid proxy" << endl; - return EXIT_FAILURE; + cerr << argv[0] << ": invalid proxy" << endl; + return EXIT_FAILURE; } HelloPrx oneway = HelloPrx::uncheckedCast(twoway->ice_oneway()); HelloPrx batchOneway = HelloPrx::uncheckedCast(twoway->ice_batchOneway()); @@ -76,85 +76,85 @@ HelloClient::run(int argc, char* argv[]) char c; do { - try - { - cout << "==> "; - cin >> c; - if(c == 't') - { - twoway->sayHello(); - } - else if(c == 'o') - { - oneway->sayHello(); - } - else if(c == 'O') - { - batchOneway->sayHello(); - } - else if(c == 'd') - { - if(secure) - { - cout << "secure datagrams are not supported" << endl; - } - else - { - datagram->sayHello(); - } - } - else if(c == 'D') - { - if(secure) - { - cout << "secure datagrams are not supported" << endl; - } - else - { - batchDatagram->sayHello(); - } - } - else if(c == 'f') - { - communicator()->flushBatchRequests(); - } - else if(c == 'S') - { - secure = !secure; - - twoway = HelloPrx::uncheckedCast(twoway->ice_secure(secure)); - oneway = HelloPrx::uncheckedCast(oneway->ice_secure(secure)); - batchOneway = HelloPrx::uncheckedCast(batchOneway->ice_secure(secure)); - datagram = HelloPrx::uncheckedCast(datagram->ice_secure(secure)); - batchDatagram = HelloPrx::uncheckedCast(batchDatagram->ice_secure(secure)); - - if(secure) - { - cout << "secure mode is now on" << endl; - } - else - { - cout << "secure mode is now off" << endl; - } - } - 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; - } + try + { + cout << "==> "; + cin >> c; + if(c == 't') + { + twoway->sayHello(); + } + else if(c == 'o') + { + oneway->sayHello(); + } + else if(c == 'O') + { + batchOneway->sayHello(); + } + else if(c == 'd') + { + if(secure) + { + cout << "secure datagrams are not supported" << endl; + } + else + { + datagram->sayHello(); + } + } + else if(c == 'D') + { + if(secure) + { + cout << "secure datagrams are not supported" << endl; + } + else + { + batchDatagram->sayHello(); + } + } + else if(c == 'f') + { + communicator()->flushBatchRequests(); + } + else if(c == 'S') + { + secure = !secure; + + twoway = HelloPrx::uncheckedCast(twoway->ice_secure(secure)); + oneway = HelloPrx::uncheckedCast(oneway->ice_secure(secure)); + batchOneway = HelloPrx::uncheckedCast(batchOneway->ice_secure(secure)); + datagram = HelloPrx::uncheckedCast(datagram->ice_secure(secure)); + batchDatagram = HelloPrx::uncheckedCast(batchDatagram->ice_secure(secure)); + + if(secure) + { + cout << "secure mode is now on" << endl; + } + else + { + cout << "secure mode is now off" << endl; + } + } + 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'); @@ -166,15 +166,15 @@ HelloClient::interruptCallback(int) { try { - communicator()->destroy(); + communicator()->destroy(); } catch(const IceUtil::Exception& ex) { - cerr << appName() << ": " << ex << endl; + cerr << appName() << ": " << ex << endl; } catch(...) { - cerr << appName() << ": unknown exception" << endl; + cerr << appName() << ": unknown exception" << endl; } exit(EXIT_SUCCESS); } |