PDA

View Full Version : lists ip address range



milli
16th May 2011, 15:52
How can i calculate the range from an Ip?
For example,i found that my pc's current local ip is 192.168.1.2.I want to list from 192.168.1.1 to 192.168.1.254.
Also,is there a way to calculate the netmask length?
Any help would be appreciated!

wysota
17th May 2011, 00:27
There is no way to retrieve a netmask from an IP address. You need to know the mask for a particular subnet.

ChrisW67
17th May 2011, 00:51
If that is the address of one of your local machine interfaces then you can get the network mask (or prefix length) for that interface in the relevant QNetworkAddressEntry otherwise, as Wysota says, you cannot derive it.

milli
17th May 2011, 01:42
If that is the address of one of your local machine interfaces then you can get the network mask (or prefix length) for that interface in the relevant QNetworkAddressEntry otherwise, as Wysota says, you cannot derive it.

Yes it is the address of my local machine interface,and i have used the class QnetworkAddressEntry to get both ip address and netmask.Prefix length is that i wanted,i used to call it number of network bits or netmask length and it is confusing me.
Thanks a lot..!