Code example for InetSocketAddress

Methods: getHostNamegetPort

0
    /** 
     * Creates a ServerAddress with default port 
     * @param addr host address 
     */ 
    public ServerAddress( InetAddress addr ){
        this( new InetSocketAddress( addr , defaultPort() ) );
    } 
 
    /** 
     * Creates a ServerAddress 
     * @param addr host address 
     * @param port mongod port 
     */ 
    public ServerAddress( InetAddress addr , int port ){
        this( new InetSocketAddress( addr , port ) );
    } 
 
    /** 
     * Creates a ServerAddress 
     * @param addr inet socket address containing hostname and port 
     */ 
    public ServerAddress( InetSocketAddress addr ){
        _host = addr.getHostName();
        _port = addr.getPort();
    } 
 
    // -------- 
    // equality, etc... 
    // -------- 
Connect your IDE to all the code out there  Get Codota for Java