diff options
Diffstat (limited to 'cpp/demo/book/printer/Client.cpp')
-rw-r--r-- | cpp/demo/book/printer/Client.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/cpp/demo/book/printer/Client.cpp b/cpp/demo/book/printer/Client.cpp index e7190622a6b..7a2d07297e0 100644 --- a/cpp/demo/book/printer/Client.cpp +++ b/cpp/demo/book/printer/Client.cpp @@ -18,26 +18,36 @@ main(int argc, char * argv[]) { int status = 0; Ice::CommunicatorPtr ic; - try { + try + { ic = Ice::initialize(argc, argv); - Ice::ObjectPrx base = ic->stringToProxy( - "SimplePrinter:default -p 10000"); + Ice::ObjectPrx base = ic->stringToProxy("SimplePrinter:default -p 10000"); PrinterPrx printer = PrinterPrx::checkedCast(base); - if (!printer) + if(!printer) + { throw "Invalid proxy"; + } printer->printString("Hello World!"); - } catch (const Ice::Exception & ex) { + } + catch(const Ice::Exception& ex) + { cerr << ex << endl; status = 1; - } catch (const char * msg) { + } + catch(const char* msg) + { cerr << msg << endl; status = 1; } - if (ic) { - try { + if(ic) + { + try + { ic->destroy(); - } catch (const Ice::Exception & ex) { + } + catch (const Ice::Exception& ex) + { cerr << ex << endl; status = 1; } |