Pergunta

I need to get all PCs IP-adresses in my local network. How should I properly do that if I can using QtNetwork? I tired use

QNetworkInterface::allAddresses();
QNetworkInterface::allInterfaces();

but it's definently not what I need.

P.S.

I need get IP's to able connect to some Postgresql servers, is there some Postgresql driver features maybe to make things easier?

Foi útil?

Solução

What you need is called "Network discovery". There's a lot of different approaches each dedicated to a specific subdomain. The approach of the lower level is called ARP, Address Resolution Protocol see a nice tutorial e.g. here http://tournasdimitrios1.wordpress.com/2011/01/26/discover-your-local-network-with-arp-scan-on-linux/ . If you need a service discovery then you probably should go with ZeroConf & friends http://doc.qt.digia.com/qq/qq23-bonjour.html

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top