C# 如何使用.net获取子网掩码?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13901436/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get subnet mask using .net?
提问by BrMe
I want to get client subnet mask using c#.
我想使用 c# 获取客户端子网掩码。
How can I get it?
我怎么才能得到它?
采纳答案by Soner G?nül
First of all, check NetworkInterfaceclass first. There are a lot of information in it. And these articles will be helpful for you:
首先,首先检查NetworkInterface类。里面有很多信息。这些文章将对您有所帮助:
回答by Evgeny Lukashevich
It's impossible to know what subnet mask client's network is using (if we are talking about D and E class IP addresses).
不可能知道客户端的网络正在使用什么子网掩码(如果我们谈论的是 D 和 E 类 IP 地址)。
My assumption is that by "client" you mean a remote computer connected to your server. Otherwise see @Soner G?nül answer.
我的假设是,“客户端”是指连接到服务器的远程计算机。否则请参阅@Soner G?nül 答案。

