iscomar001
4/28/2014 - 5:15 PM

Net utils

Net utils

package Net;


import java.net.InetAddress;
import java.net.UnknownHostException;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Omar
 */
public class NetUtils {

    public static String getIp(){
        try {
            String IP = "";
            //OMAR Campañas aqui se genera el query para el preview
            InetAddress miIP = InetAddress.getLocalHost();
            IP = miIP.getHostAddress();
            return IP;
        } catch (UnknownHostException ex) {
            System.out.println(ex.getMessage());
        }
        return "";
    }
    public static String getHost(){
        String usuarioWindows = "";
        try {
            //OMAR Campañas aqui se genera el query para el preview
            InetAddress miIP = InetAddress.getLocalHost();
            usuarioWindows = miIP.getHostName();
            return usuarioWindows;
        } catch (UnknownHostException ex) {
            System.out.println(ex.getMessage());
        }
        return usuarioWindows;
    }
    
    
}