Archived
This forum has been archived. Please start a new discussion on GitHub.
Search for running ICE-servers on the LAN
in Help Center
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?
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?
0
Comments
-
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.0 -
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 running0 -
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.0 -
Thanks for the tip! I'll consider it!0