Hello,
I've played a bit around with the mobile webserver in my local network. So I needed the IP-Adress that my phone got from the dhcp. Because I did not find a way to get the IP on the phone I sat down and wrote the following application that displays a list of all IP-adresses the phone is currently bound to.
Code:#include <QApplication> #include <QHostAddress> #include <QNetworkInterface> #include <QScopedPointer> #include <QListView> #include <QStringListModel> int main(int argc, char** argv) { QApplication app(argc, argv); QStringList adresses; foreach (QHostAddress adress, QNetworkInterface::allAddresses()) { adresses << adress.toString(); } QScopedPointer<QListView> list_view(new QListView(NULL)); QScopedPointer<QStringListModel> model(new QStringListModel(NULL)); list_view->setModel(model.data()); model->setStringList(adresses); list_view->showMaximized(); return app.exec(); }




