Class InetSocketAddressWrapper

    • Constructor Detail

      • InetSocketAddressWrapper

        public InetSocketAddressWrapper​(int port)
        Creates a socket address where the IP address is the wildcard address and the port number a specified value.

        A valid port value is between 0 and 65535. A port number of zero will let the system pick up an ephemeral port in a bind operation.

        Parameters:
        port - The port number
        Throws:
        IllegalArgumentException - if the port parameter is outside the specified range of valid port values.
      • InetSocketAddressWrapper

        public InetSocketAddressWrapper​(InetAddress addr,
                                        int port)
        Creates a socket address from an IP address and a port number.

        A valid port value is between 0 and 65535. A port number of zero will let the system pick up an ephemeral port in a bind operation.

        A null address will assign the wildcard address.

        Parameters:
        addr - The IP address
        port - The port number
        Throws:
        IllegalArgumentException - if the port parameter is outside the specified range of valid port values.
      • InetSocketAddressWrapper

        public InetSocketAddressWrapper​(String hostname,
                                        int port)
        Creates a socket address from a hostname and a port number.

        An attempt will be made to resolve the hostname into an InetAddress. If that attempt fails, the address will be flagged as unresolved.

        If there is a security manager, its checkConnect method is called with the host name as its argument to check the permission to resolve it. This could result in a SecurityException.

        A valid port value is between 0 and 65535. A port number of zero will let the system pick up an ephemeral port in a bind operation.

        Parameters:
        hostname - the Host name
        port - The port number
        Throws:
        IllegalArgumentException - if the port parameter is outside the range of valid port values, or if the hostname parameter is null.
        SecurityException - if a security manager is present and permission to resolve the host name is denied.
        See Also:
        InetSocketAddress.isUnresolved()
      • InetSocketAddressWrapper

        public InetSocketAddressWrapper​(InetSocketAddress address)
        Converts a address to an InetSocketAddress
        Parameters:
        address - address to be converted
        Throws:
        IllegalArgumentException - if the port of the converted address is outside the specified range of valid port values.