Home Help Center

Search for running ICE-servers on the LAN

renzorenzo Member Aleksey BlokhinOrganization: JSC "SRI Vector"Project: Remote host monitoring system
Hi,
I need to develop an application that must display hosts' IP (in the given range) on which the ICE-server is running.
For example, previously the SNMP protocol used for this purpose. All hosts were pinged by SNMP-agent and if the responce is recieved then SNMP is running. Now I want to replace SNMP by ICE.
Is there a correct way to implement search for hosts with running ICE-server?

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    You'll need to implement the discovery yourself. If your network support it, you could use Ice multicast support (demo/Ice/multicast from your Ice demo distribution as an example). Another strategy would be to scan a range of IP addresses by trying to connect to each IP individually on a pre-defined port. You can use AMI and timeouts to ensure the discovery doesn't take too long.

    Cheers,
    Benoit.
  • renzorenzo Member Aleksey BlokhinOrganization: JSC "SRI Vector"Project: Remote host monitoring system
    Thanks for your answer, Benoit

    Now, I use the following simple code for it:
    // ...
    # define ICESERVER             "IceServer"
    # define ICESERVER_PORT        9871
    // ...
    bool isAvailable( const QHostAddress &addr, const QSet <int>& openports ) const
    {
            Q_UNUSED(openports);
            Ice::CommunicatorPtr communicator = Ice::initialize();
            Ice::ObjectPrx proxy;
            QString proxy_str;
            proxy_str = QString(ICESERVER).append(":tcp -h ").append(addr.toString()).append(" -p ").append(ICESERVER_PORT);
            try
            {
                proxy = communicator->stringToProxy(proxy_str.toStdString());
                proxy = proxy->ice_timeout(1000);
                proxy->ice_ping();
            }
            catch(const Ice::Exception& ex)
            {
                communicator->destroy();
                return false;
            }
            communicator->destroy();
            return true;
    }
    
    I try to ping the server and if the exception throws then server isn't running
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Creating a communicator for a single ice_ping call is a bit costly. I recommend to create a single communicator for the lifetime of your application and re-use it instead.

    Cheers,
    benoit.
  • renzorenzo Member Aleksey BlokhinOrganization: JSC "SRI Vector"Project: Remote host monitoring system
    Thanks for the tip! I'll consider it!
Sign In or Register to comment.