Archived

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

WSAECONNREFUSED error (subscriber errored out: network.cpp:1218)

Hello all,

Im trying to connect through icestorm a client (in c++ using c++ builder 2009) and a server (in java) but i'm getting the following error in the icebox console:

[ 11/04/09 13:34:22.078 C:/Ice-3.3.0-BCC/bin/icebox.exe: Subscriber: c31b54 a1:6f:78:4e:-3226096e:124bf2a699a:-8000: subscriber errored out: Network.cpp:1218: Ice::ConnectionRefusedException: connection refused: WSAECONNREFUSED retry: 0/0 ]

I think this is due to a configuration problem.

this is the client initializing code:

Ice::CommunicatorPtr ic = communicator();

IceStorm::TopicManagerPrx topicManager = IceStorm::TopicManagerPrx::checkedCast(ic->propertyToProxy("IceStorm.TopicManager.Proxy"));

Ice::ObjectAdapterPtr adapter = ic->createObjectAdapter("AlarmClient.Subscriber");
Ice::ObjectPrx alertBase = adapter->addWithUUID(new AlarmEventListenerI());
alarmEventListenerPrx = AlarmEventListenerPrx::uncheckedCast(alertBase);

ListenerI* listenerI = new ListenerI();
listenerI->setAlarmEventListenerPrx(alarmEventListenerPrx);
Ice::ObjectPrx listenerBaseSub = adapter->addWithUUID(listenerI);

adapter->activate();

/*
SOME CODE
*/

Ice::ObjectPrx publisher = asdsTopic->getPublisher();
SearchPrx searchBasePub = SearchPrx::uncheckedCast(publisher);

IceStorm::QoS qos;
try {
asdaTopic->subscribeAndGetPublisher(qos, listenerBaseSub);
} catch (IceStorm::AlreadySubscribed& e) {

return 1;
}

the client configuration:

#
# This property is used to configure the endpoints of the
# subscriber adapter.
#
AlarmClient.Subscriber.Endpoints=tcp -p 10008

#
# This property is used by the clients to connect to IceStorm.
#
IceStorm.TopicManager.Proxy=DemoIceStorm/TopicManager:default -p 10002

#
# Network Tracing
#
# 0 = no network tracing
# 1 = trace connection establishment and closure
# 2 = like 1, but more detailed
# 3 = like 2, but also trace data transfer
#Ice.Trace.Network=3


Ice.ThreadPool.Server.Size=50
Ice.ThreadPool.Client.Size=50


And finally this is the server code:

Ice.Communicator ic = communicator();

IceStorm.TopicManagerPrx manager = IceStorm.TopicManagerPrxHelper
.checkedCast(ic.propertyToProxy("IceStorm.TopicManager.Proxy"));


Ice.ObjectAdapter adapter = ic.createObjectAdapter("AlarmClient.Subscriber");
ObjectPrx thisObjectSub = adapter.addWithUUID(new ListenerI());
Ice.ObjectPrx alertBase = adapter.addWithUUID(new AlarmEventListenerI());
alarmEventListenerPrx = AlarmEventListenerPrxHelper.uncheckedCast(alertBase);

adapter.activate();

/* SOME CODE */

Ice.ObjectPrx publisher = asdsTopic.getPublisher();
SearchPrx thisObjectPub = SearchPrxHelper.uncheckedCast(publisher);
try {asdaTopic.subscribeAndGetPublisher(null, thisObjectSub);
} catch (IceStorm.AlreadySubscribed e) {
e.printStackTrace();
return 1;
} catch (IceStorm.BadQoS e) {
e.printStackTrace();
return 1;

and its configuration:

#
# This property is used to configure the endpoints of the
# subscriber adapter.
#
AlarmClient.Subscriber.Endpoints=tcp:udp

#
# This property is used by the clients to connect to IceStorm.
#
IceStorm.TopicManager.Proxy=DemoIceStorm/TopicManager:default -p 10002

#
# Network Tracing
#
# 0 = no network tracing
# 1 = trace connection establishment and closure
# 2 = like 1, but more detailed
# 3 = like 2, but also trace data transfer
#Ice.Trace.Network=3


Ice.ThreadPool.Server.Size=50
Ice.ThreadPool.Client.Size=50

any help please?

Comments

  • matthew
    matthew NL, Canada
    I find it very hard to follow all that code. Its far simpler to post a self-contained complete example than code fragments, unless they are very specific. What you need to discover is what subscriber is causing the issue, and why. What I would recommend until you work out the issue is to give the subscribers fixed identities, and enable network tracing (Ice.Trace.Network=2) in both IceStorm and your subscribers.

    Also do you really need 50 threads in your client & server thread pools? It seems very unlikely.