Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Generating list of all possible IP in Subnet
I can't found a simple solution to obtain a list of all available ip addresses in a given subnet.
For exemple if I give the ip (192.168.1.1) with the subnet mask (255.255.255.0) I need a returned list of all addresses from 192.168.1.0 to 192.168.1.255.
In other word I want to write a method like this :
QList<QHostAddress> getAllAddresses(QHostAddress ip, QHostAddress subnetMask);
Iterate from 0 to 256 and add the generated IPs to your QList
That's an idea but I need a generic function working for any possible ip, subnet pair
You can have a look here for inspiration
but I need a generic function working for any possible ip, subnet pair
So where's the problem?
btw: It's even easier - IPv4 is a simple 32bit integer counting up. So 192.168.1.1 is 0xc0.0xa8.0x01.0x01 = 0xc0a80101 = 3232235777. So simply count up and you get your ips.
This post is deleted!
Is the IP list of a subnet always results in a continuous IP range? I that way counting is a simple solution indeed.
Is the IP list of a subnet always results in a continuous IP range?
I already told you in my first post...