简体   繁体   中英

List IP addresses in a subnet C# .net core

Given a string representing a network like 58.128.0.0/16

I want a list of all non-broadcast (not.0 or.255) within the subnet (58.128.0.1, 58.128.0.2, etc). Unfortunately all answers I can find use IPNetwork.Parse() which no longer exists in .net core 3.0.

Seems there is a library now for this https://github.com/jsakamoto/ipaddressrange

IPAddressRange range = IPAddressRange.Parse("58.128.0.0/16");
foreach(var ip in range) {

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM