/// /// <summary> /// Creates a socket address from an IP address and a port number. /// <para> /// A valid port value is between 0 and 65535. /// A port number of {@code zero} will let the system pick up an /// ephemeral port in a {@code bind} operation. /// <P> /// A {@code null} address will assign the <i>wildcard</i> address. /// </para> /// <para> /// </para> /// </summary> /// <param name="addr"> The IP address </param> /// <param name="port"> The port number </param> /// <exception cref="IllegalArgumentException"> if the port parameter is outside the specified /// range of valid port values. </exception> public InetSocketAddress(InetAddress addr, int port) { Holder = new InetSocketAddressHolder(null, addr == null ? InetAddress.AnyLocalAddress() : addr, CheckPort(port)); }
/// <summary> /// Creates a socket address where the IP address is the wildcard address /// and the port number a specified value. /// <para> /// A valid port value is between 0 and 65535. /// A port number of {@code zero} will let the system pick up an /// ephemeral port in a {@code bind} operation. /// </para> /// <para> /// </para> /// </summary> /// <param name="port"> The port number </param> /// <exception cref="IllegalArgumentException"> if the port parameter is outside the specified /// range of valid port values. </exception> public InetSocketAddress(int port) : this(InetAddress.AnyLocalAddress(), port) { }