Code example for InetSocketAddress

Methods: getHostName, getPort

0
    /** 
     * Creates a ServerAddress 
     * @param addr inet socket address containing hostname and port 
     */ 
    public ServerAddress( InetSocketAddress addr ){
        _host = addr.getHostName();
        _port = addr.getPort();
    } 
 
    // -------- 
    // equality, etc... 
    // -------- 
 
 
    /** 
     * Determines whether this address is the same as a given host. 
     * @param host the address to compare 
     * @return if they are the same 
     */ 
    public boolean sameHost( String host ){
        int idx = host.indexOf( ":" );