Home Help Center

createObjectAdapter and createObjectAdapterWithEndpoints

AlexKomAlexKom Member Alexander KomarnitskyOrganization: HomeProject: Testing ICE features
Good day, all!

I try to create a server-client application with callback function on client side. For using callback I must create an adapter on server side with function createObjectAdapter in the following way:

Ice::ObjectAdapterPtr adapter = ic->createObjectAdapter("tcp -p 10000:udp -p 10000");

and add to it one realized interface "Some" (thru it i want to receive a callback interface from client):

adapter->add(new SomeI, Ice::stringToIdentity("Some"));

But when I try to connect to it from client with command by next way:

Ice::ObjectPrx base = ic->stringToProxy("Some:tcp -p 10000:udp -p 10000");
SomePrx prx = SomePrx ::checkedCast(base);

I get an error:
.\Network.cpp:557: Ice::ConnectionRefusedException:
connection refused: WSAECONNREFUSED

If i create an adapter on server side with createObjectAdapterWithEndpoints() and accordingly change client - all works fine.

I look in example "Callback" - all is fine work there. But in it using a ICE::Application. How I can resolve my problem without using this class?
What I must to do for fixing my problem?

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    createObjectAdapter() gets endpoint information from properties. The argument is the name of the object adapter, not the endpoints. To create an object adapter with a name and endpoints, use createObjectAdapterWithEndpoints():
    Ice::ObjectAdapterPtr adapter = ic->createObjectAdapterWithEndpoints("MyAdapter", "tcp -p 10000:udp -p 10000");
    

    Also, don't forget that you must activate this object adapter before it will dispatch any requests:
    adapter->activate();
    
  • AlexKomAlexKom Member Alexander KomarnitskyOrganization: HomeProject: Testing ICE features
    Thanks a lot, i resolve my problem :)
Sign In or Register to comment.