Encapsulates an IP Address.
예제 #1
0
        public IPEndPoint(IPAddress address, int port)
        {
            if (address == null)
                throw new ArgumentNullException("address");

            Address = address;
            Port = port;
        }
예제 #2
0
 public IPEndPoint(long address, int port)
 {
     Address = new IPAddress(address);
     Port = port;
 }
예제 #3
0
                /// <summary>
                ///   Used to tell whether an address is a loopback.
                ///   All IP addresses of the form 127.X.Y.Z, where X, Y, and Z are in 
                ///   the range 0-255, are loopback addresses.
                /// </summary>
                /// <param name="addr">Address to compare</param>
                /// <returns></returns>
                public static bool IsLoopback (IPAddress address)
                {
                        if(address.m_Family == AddressFamily.InterNetwork)
                                return (address.m_Address & 0xFF) == 127;
                        else {
                                for(int i=0; i<6; i++) {
                                        if(address.m_Numbers[i] != 0)
                                                return false;
                                }

                                return NetworkToHostOrder((short)address.m_Numbers[7]) == 1;
                        }
                }
예제 #4
0
                public static bool TryParse (string ipString, out IPAddress address)
                {
                        if (ipString == null)
                                throw new ArgumentNullException ("ipString");

                        if ((address = ParseIPV4 (ipString)) == null)
                                if ((address = ParseIPV6 (ipString)) == null)
                                        return false;
                        return true;
                }