/// <summary> /// Initializes a new instance of the IPPort class with the address specified as a <see cref="RemoteDesktop.Net.IP"/> and the specified port number. /// </summary> /// <param name="ip">The <see cref="RemoteDesktop.Net.IP"/> value of the IP address.</param> /// <param name="port">The <see cref="ushort"/> value of Port number.</param> public IPPort(IP ip, ushort port) { IP = ip; Port = port; }
/// <summary> /// Initializes a new instance of the IPPort class with the address specified as a <see cref="RemoteDesktop.Net.IP"/> . /// </summary> /// <param name="ip">The <see cref="RemoteDesktop.Net.IP"/> value of the IP address.</param> public IPPort(IP ip) { IP = ip; }
/// <summary> /// Initializes a new instance of the IPPort class with the address specified as a <see cref="byte"/> array and the specified port number. /// </summary> /// <param name="address">The <see cref="byte"/> array value of the IP address.</param> /// <param name="port">The <see cref="ushort"/> value of Port number.</param> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="ArgumentException"></exception> public IPPort(byte[] address, ushort port)//65535 { IP = new IP(address); Port = port; }
/// <summary> /// Initializes a new instance of the IPPort class with the address specified as a <see cref="byte"/> array. /// </summary> /// <param name="address">The byte array value of the IP address.</param> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="ArgumentException"></exception> public IPPort(byte[] address) { IP = new IP(address); }
/// <summary> /// Initializes a new instance of the IPPort class with the address specified as an <see cref="long"/>. /// </summary> /// <param name="newAddress">The long value of the IP address. For example, the value 0x2414188f in big-endian format would be the IP address "143.24.20.36".</param> /// <exception cref="ArgumentOutOfRangeException"></exception> public IPPort(long newAddress)//4294967295L { IP = new IP(newAddress); }
/// <summary> /// Converts an Internet address to its standard notation. /// </summary> /// <param name="format"></param> /// <returns>A string that contains the IP address in either IPv4 notation.</returns> public string ToString(string format) => Port == 0 ? $"{IP.ToString(format)}" : $"{IP.ToString(format)}:{Port}";