Archived
This forum has been archived. Please start a new discussion on GitHub.
createObjectAdapter and createObjectAdapterWithEndpoints
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?
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?
0
Comments
-
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();
0 -
Thanks a lot, i resolve my problem0