is IP Address Host name Resolvable - Android Network

Android examples for Network:IP Address

Description

is IP Address Host name Resolvable

Demo Code


//package com.java2s;

import java.net.InetAddress;

import java.net.UnknownHostException;

public class Main {
    private static boolean isResolvable(String hostname) {
        try {//from w w w .j av a  2s  .  co m
            InetAddress.getAllByName(hostname);
            return true;
        } catch (UnknownHostException e) {
            return false;
        }
    }
}

Related Tutorials