InetSocketAddress represents an the combination of an IP (Internet Protocol) address and a port number. The constructors allow you to specify the IP address as an InetAddress or as a hostname, and they also allow you to omit the IP address, in which case the wildcard address is used (this is useful for server sockets). Figure 12-9. java.net.InetSocketAddresspublic class InetSocketAddress extends SocketAddress { // Public Constructors public InetSocketAddress (int port ); public InetSocketAddress (InetAddress addr , int port ); public InetSocketAddress (String hostname , int port ); // Public Class Methods 5.0 public static InetSocketAddress createUnresolved (String host , int port ); // Public Instance Methods public final InetAddress getAddress ( ); public final String getHostName ( ); public final int getPort ( ); public final boolean isUnresolved ( ); // Public Methods Overriding Object public final boolean equals (Object obj ); public final int hashCode ( ); public String toString ( ); } |