IsPrivateAddress() публичный статический Метод

Checks the Contact SIP URI host and if it is recognised as a private address it is replaced with the socket the SIP message was received on. Private address space blocks RFC 1597. 10.0.0.0 - 10.255.255.255 172.16.0.0 - 172.31.255.255 192.168.0.0 - 192.168.255.255
public static IsPrivateAddress ( string host ) : bool
host string
Результат bool
Пример #1
0
            public void Test172IPRangeIsPrivate()
            {
                Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);

                Assert.IsFalse(IPSocket.IsPrivateAddress("172.15.1.1"), "Public IP address was mistakenly identified as private.");
                Assert.IsTrue(IPSocket.IsPrivateAddress("172.16.1.1"), "Private IP address was not correctly identified.");

                Console.WriteLine("-----------------------------------------");
            }
Пример #2
0
 public static bool IsPrivate(this IPAddress address)
 {
     return IPSocket.IsPrivateAddress(address.ToString());
 }