There is a Qt program that exchanges files over a local network. It is necessary to add receipt of the list of hosts
foreach (const QHostAddress &address, QNetworkInterface::allAddresses()) { if (address.protocol() == QAbstractSocket::IPv4Protocol && address !=QHostAddress(QHostAddress::LocalHost)) currenthost=address.toString(); } Getting a local address is done as follows. Then I just try to connect to each of the 255 sockets that may be on the local network by replacing the last digits of the local address with the numbers 1-255 and if the connection works, I write the address in the list
But if you run the program from a mobile device with mobile Internet, there will be no local network. How to catch such an event without using native checks on each platform?