I am writing a program that gets From IP address and To IP address from the user and displays the list of IP addresses between them. For example, if the user gives 10.0.0.1 and 10.0.0.5 then I will display the five IP addresses between these two. The current solution that is coming in my mind are:
What solution should I adopt between these (or suggest a better solution)? For the first solution, what is the link for IP address table/list?
What is the solution in terms of JavaScript or Java?
First split the IP addresses with .
. From the first IP address, start increasing the fourth part up to 255 and then add 1 to the third part and set the fourth one to 1. Until you reach the to IP address.
10.0.10.10
-> 00001010 00000000 00001010 00001010
-> 167774730
10.1.45.1
-> 00001010 00000001 00101101 00000001
-> 167849217
11111111
and 00000000
.That's all.