Let's say I have two IP addresses (in .NET, the System.Net.IPAddress
class). How can I iterate over all the IP addresses between two given addresses?
For example, let one address be 192.168.1.1 and the other 192.168.2.3. I want to somehow iterate over all the addresses in between and print them to the console.
Thank you.
In the end I ended up using the approach provided in this answer.
It's a little more complicated but it works well without using deprecated properties. It converts IP addresses to uint
s, increments them, then converts them back.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With