No diré muchas tonterías, solo te publicaré el código. El código específico es el siguiente:
public String getLocalHostName () {String hostName; try {inetAddress addr = inetAdDress.getLocalHost (); hostname = addR.gethostName ();} catch (excepción ex) {hostname = "";} return hostName;} public string [] getallLocalHostip () {string [] Ret = neo getLocalHostName (); if (hostname.length ()> 0) {inetAddress [] addrs = inetAddress.getallByName (hostname); if (addrs.length> 0) {ret = new String [addrs.length]; for (int i = 0; i <addrs.length; i ++) {ret [i] = = = = = = = addrs [i] .gethostaddress ();}}}} capt (excepción ex) {ret = null;} return ret;}El código anterior es el código relevante para obtener IP locales de múltiples tarjetas de red introducidas por el editor. Si tiene alguna pregunta, déjame un mensaje. Me comunicaré con usted a tiempo y aprenderé y progresaré juntos. Al mismo tiempo, me gustaría agradecerle mucho por su apoyo al sitio web de Wulin Network.