This forum has been archived. Please start a new discussion on GitHub.

Local asynchronous calls arrive never


I have problem with local calls to IceObjects via a proxy (with Local call I mean, that the tcp stack is not used, since the communicator recognizes that it is the same process).
If I do the blocking call, everything is ok, but if I use the begin_* version, the call never arrives.

Here is the HelloWorld example with client and server in one communicator with a blocking and a non blocking call:
#include <Ice/Ice.h>
#include "Printer.h"

using namespace std;
using namespace Test;

class PrinterI : public Printer {
    virtual void printString(const string& s,
                             const Ice::Current&);

printString(const string& s, const Ice::Current&)
    cout << s << endl;

main(int argc, char* argv[])
    int status = 0;
    Ice::CommunicatorPtr ic;
    try {
        ic = Ice::initialize(argc, argv);
        Ice::ObjectAdapterPtr adapter = ic->createObjectAdapterWithEndpoints("SimplePrinterAdapter", "default -p 10000");
        Ice::ObjectPtr object = new PrinterI;
        adapter->add(object, ic->stringToIdentity("SimplePrinter"));
        Ice::ObjectPrx base = ic->stringToProxy(
                                        "SimplePrinter:default -p 10000");
        PrinterPrx printer = PrinterPrx::checkedCast(base);
        if (!printer)
            throw "Invalid proxy";
        printer->printString("Hello World!"); // <- this works
        printer->begin_printString("Hello World!"); // <- this does NOT work
    } catch (const Ice::Exception& e) {
        cerr << e << endl;
        status = 1;
    } catch (const char* msg) {
        cerr << msg << endl;
        status = 1;
    if (ic) {
        try {
        } catch (const Ice::Exception& e) {
            cerr << e << endl;
            status = 1;
    return status;

Or am i doing something wrong?


  • benoit
    benoit Rennes, France

    The begin_printString call is failing and you don't know why because you don't provide a callback or call the corresponding end_printString method on the returned result, try changing the call to:
           printer->end_printString(printer->begin_printString("Hello World!"));

    It should throw an Ice::CollocationOptimizationException exception indicating that collocation optimization isn't supported with AMI. You will therefore need to disable collocation optimization for this to work. You can do this by setting Ice.Default.CollocationOptimized=0 or programmatically:
    printer->ice_collocationOptimized(false)->begin_printString("Hello World!");

    Note that the next Ice version (3.6) will support AMI and collocation optimization.

  • That is unfortunate, but thank you for your quick response.