Name
InetSocketAddress
Synopsis
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.InetSocketAddress
public 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( ); }
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.