~ubuntu-branches/ubuntu/quantal/zeroc-ice/quantal

« back to all changes in this revision

Viewing changes to demo/book/printer/Client.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Francisco Moya
  • Date: 2008-02-12 16:28:20 UTC
  • mfrom: (4.1.5 hardy)
  • Revision ID: james.westby@ubuntu.com-20080212162820-x3e046s7nmabeswv
Tags: 3.2.1-8
Added -g to global compilation flags (Closes: #465074).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// **********************************************************************
2
2
//
3
 
// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
 
3
// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
4
4
//
5
5
// This copy of Ice is licensed to you under the terms described in the
6
6
// ICE_LICENSE file included in this distribution.
19
19
    int status = 0;
20
20
    Ice::CommunicatorPtr ic;
21
21
    try {
22
 
        ic = Ice::initialize(argc, argv);
23
 
        Ice::ObjectPrx base = ic->stringToProxy(
24
 
                                "SimplePrinter:default -p 10000");
25
 
        PrinterPrx printer = PrinterPrx::checkedCast(base);
26
 
        if (!printer)
27
 
            throw "Invalid proxy";
 
22
        ic = Ice::initialize(argc, argv);
 
23
        Ice::ObjectPrx base = ic->stringToProxy(
 
24
                                "SimplePrinter:default -p 10000");
 
25
        PrinterPrx printer = PrinterPrx::checkedCast(base);
 
26
        if (!printer)
 
27
            throw "Invalid proxy";
28
28
 
29
 
        printer->printString("Hello World!");
 
29
        printer->printString("Hello World!");
30
30
    } catch (const Ice::Exception & ex) {
31
 
        cerr << ex << endl;
32
 
        status = 1;
 
31
        cerr << ex << endl;
 
32
        status = 1;
33
33
    } catch (const char * msg) {
34
 
        cerr << msg << endl;
35
 
        status = 1;
 
34
        cerr << msg << endl;
 
35
        status = 1;
36
36
    }
37
37
    if (ic) {
38
 
        try {
39
 
            ic->destroy();
40
 
        } catch (const Ice::Exception & ex) {
41
 
            cerr << ex << endl;
42
 
            status = 1;
43
 
        }
 
38
        try {
 
39
            ic->destroy();
 
40
        } catch (const Ice::Exception & ex) {
 
41
            cerr << ex << endl;
 
42
            status = 1;
 
43
        }
44
44
    }
45
45
    return status;
46
46
}