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 permissiom
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()
,