Archived

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

server.exe communicate with client.exe problem.

Why my server.exe and client.exe can communicate each other at same local machine but not at different machine. How can I do it right?

Comments

  • marc
    marc Florida
    Switch on network tracing, so that you see what network address the server listens on, and to which address the client tries to connect to. Use --Ice.Trace.Network=3.
  • I try it, but have a other problem!

    /ice/ice-1.5.1/src/ice/network.cpp: 509 Ice::ConnectionRefuseException:connect refused:WSAECONNREFUSED
  • marc
    marc Florida
    This means that your server is not running, or it is not running on the specified host/port.

    Again, tracing will give you more information as to what address the client exactly tries to connect to, as well as what address the server listens to. Run both the client and the server with --Ice.Trace.Network=3.
  • code here,

    [server code]
    int argc = 0;
    Ice::PropertiesPtr properties = Ice::createProperties();
    properties->setProperty("Hello.Endpoints", "tcp -p 10000");
    properties->setProperty("Ice.Trace.Network", "3");
    communicator = Ice::initializeWithProperties(argc, 0, properties);
    log = new LogI;
    communicator->setLogger(log);
    adapter = communicator->createObjectAdapter("Hello");

    properties->setProperty("Ice.Trace.Network", "3");
    Ice::ObjectPrx obj = communicator->stringToProxy("Player:tcp -p 10001");
    PlayerPrx::uncheckedCast(obj);

    [client ode:]
    PropertiesPtr properties = _communicator->getProperties();
    properties->setProperty("Ice.Trace.Network", "3");

    Ice::ObjectPrx obj = _communicator->stringToProxy("hello:tcp -p 10000");
    _proxy = HelloPrx::uncheckedCast(obj);
    _currentProxy = _proxy;

    properties->setProperty("Ice.Trace.Network", "3");
    properties->setProperty("Player.Endpoints", "tcp -p 10001");

    ObjectAdapterPtr adapter = _communicator->createObjectAdapter("Player");

    adapter->add(new PlayerI(), stringToIdentity("Player"));
    adapter->activate();

    _PlayerProxy = PlayerPrx::uncheckedCast(
    adapter->createProxy(stringToIdentity("Player")));

    what's problem with it?
  • code here,

    [server code]
    int argc = 0;
    Ice::PropertiesPtr properties = Ice::createProperties();
    properties->setProperty("Hello.Endpoints", "tcp -p 10000");
    properties->setProperty("Ice.Trace.Network", "3");
    communicator = Ice::initializeWithProperties(argc, 0, properties);
    log = new LogI;
    communicator->setLogger(log);
    adapter = communicator->createObjectAdapter("Hello");

    properties->setProperty("Ice.Trace.Network", "3");
    Ice::ObjectPrx obj = communicator->stringToProxy("Player:tcp -p 10001");
    PlayerPrx::uncheckedCast(obj);

    [client ode:]
    PropertiesPtr properties = _communicator->getProperties();
    properties->setProperty("Ice.Trace.Network", "3");

    Ice::ObjectPrx obj = _communicator->stringToProxy("hello:tcp -p 10000");
    _proxy = HelloPrx::uncheckedCast(obj);
    _currentProxy = _proxy;

    properties->setProperty("Ice.Trace.Network", "3");
    properties->setProperty("Player.Endpoints", "tcp -p 10001");

    ObjectAdapterPtr adapter = _communicator->createObjectAdapter("Player");

    adapter->add(new PlayerI(), stringToIdentity("Player"));
    adapter->activate();

    _PlayerProxy = PlayerPrx::uncheckedCast(
    adapter->createProxy(stringToIdentity("Player")));

    what's problem with it?
  • marc
    marc Florida
    Again, please have a look at the trace output for both the client and the server, then you will find out what the problem is. You should not set any special logger for that, but use the standard logger that just logs to standard output.