QNetworkInterface get 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:10.0.0.1 255.255.255.0
192.168.0.1 255.255.255.0
192.168.1.1 255.255.255.0from the remote server. My pc is
192.168.0.111 255.255.255.0Is 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.
For example
@
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