QNetworkInterface get subnet mask
Hi. Is there a way to get the subnet mask?
"Get a list of the network interfaces":http://qt-project.org/doc/qt-5/qnetworkinterface.html#allInterfaces
For each interface "get a list of the address entries":http://qt-project.org/doc/qt-5/qnetworkinterface.html#addressEntries
For each entry "get netmask":http://qt-project.org/doc/qt-5/qnetworkaddressentry.html#netmask
Is there a way to get the valid ip from a list?
For example I have this list:
from the remote server. My pc is
Is there a way to select the right ip? (in this case the second, 192.168.0.1)
if you know ip address and mask you can calculate first ip address in a network.
192.168.0.111 = 0xC0A8006F
255.255.255.0 = 0xFFFFFF00
0xC0A8006F & 0xFFFFFF00 = 0xC0A80000
0xC0A80000 = 192.168.0.0
So first address of the network 192.168.0.0 is 192.168.0.1
Another option is to calculate network addresses for all 3 entries in the list and for pc.
Select the entry from the list that has the same network with pc.
Solved using your suggestion.
I hoped to find an already made function.