| public class java.net InetSocketAddress
|
Java SE 6 |
It provides an immutable object used by sockets for binding, connecting, or as returned values.
The wildcard is a special local IP address. It usually means "any"
and can only be used for bind operations.
| since | 1.4 |
| See also | java.net.Socket, java.net.ServerSocket |
| Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| public | InetSocketAddress(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
| ||||||||||
| public | InetSocketAddress(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
A
| ||||||||||
| public | InetSocketAddress(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
A valid port value is between 0 and 65535.
A port number of
| ||||||||||
| Methods | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public static InetSocketAddress | createUnresolved(String host, int port) Creates an unresolved socket address from a hostname and a port number. No attempt will be made to resolve the hostname into an InetAddress. The address will be flagged as unresolved.
A valid port value is between 0 and 65535.
A port number of
| ||||||||||||
| final public boolean | equals(Object obj) Compares this object against the specified object. The result is true if and only if the argument is
not null and it represents the same address as
this object.
Two instances of
| ||||||||||||
| final public int | hashCode() Returns a hashcode for this socket address.
| ||||||||||||
| public String | toString() Constructs a string representation of this InetSocketAddress. This String is constructed by calling toString() on the InetAddress and concatenating the port number (with a colon). If the address is unresolved then the part before the colon will only contain the hostname.
| ||||||||||||
| Properties | |||
|---|---|---|---|
| final public InetAddress | getAddress() Gets the InetAddress.
| ||
| final public String | getHostName() Gets the hostname.
| ||
| final public int | getPort() Gets the port number.
| ||
| final public boolean | isUnresolved() Checks whether the address has been resolved or not.
| ||
| About DocWeb · Bundles · Export · Export All | Top 10 · Statistics · Login |
| About Sun · Contact · Privacy · Terms of Use · Trademarks | Java SE 6 · Copyright © 1994-2009 Sun Microsystems, Inc.All rights reserved. Use is subject to license terms |
![]() |
![]() |
|