ipaddressrange icon indicating copy to clipboard operation
ipaddressrange copied to clipboard

[Question] How to find usable IPs?

Open scorpio1441 opened this issue 4 years ago • 1 comments

                var range = IPAddressRange.Parse("192.168.1.100/255.255.255.0");
                IPStartBox.Text = range.Begin.ToString(); // returns 192.168.1.0
                IPEndBox.Text = range.End.ToString(); // 192.168.1.255

I need to return first and last usable IP, which should be 192.168.1.1 and 192.168.1.254. Is this possible?

scorpio1441 avatar Jan 28 '21 04:01 scorpio1441

Unfortunately, it is impossible with the IPAddressRange object only. To determine useable addresses, it requires not only range information and also subnets information such as subnet mask. IPAddressRange knows just a range, so IPAddressRange can not do it.

If you want to resolve this issue, here is not suitable for discussion about this issue. I recommend that you ask anybody in stackoverflow.com or elsewhere like it.

jsakamoto avatar Jan 29 '21 05:01 jsakamoto