try { InetAddress addr = InetAddress.getLocalHost(); String ip=addr.getHostAddress().toString();//获得本机IP String host=addr.getHostName().toString();//获得本机名称 } catch(Exception e){ }
try { InetAddress addr = InetAddress.getLocalHost(); String ip=addr.getHostAddress().toString();//获得本机IP String host=addr.getHostName().toString();//获得本机名称 } catch(Exception e){ }