A friend used the following snippet of code to retrieve the local IP address of the host in his LAN.
int buffersize = 512; char name[buffersize]; if(gethostname
If you really use Qt, you can use this code
foreach (const QHostAddress& address, QNetworkInterface::allAddresses() ) { qDebug() << address.toString(); }
If you are not using Qt, you can study, how it is made there.