나는 장치에 대한 응용 프로그램을 작성했으며 장치 IP 주소를 가져 와서 화면에 인쇄합니다. 이 앱을 내 탭 10.1에 설치하면 IP 주소가 이상한 형식의 문자와 숫자로 나옵니 까?응용 프로그램에 대한 갤럭시 탭 10.1의 IP 주소 찾기
private String getIpAddress()
{
try
{
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();)
{
NetworkInterface intf = en.nextElement();
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();)
{
InetAddress inetAddress = enumIpAddr.nextElement();
if (!inetAddress.isLoopbackAddress()) { return inetAddress.getHostAddress().toString(); }
}
}
}
catch(SocketException ex)
{
Log.e(TAG , ex.toString());
}
return null;
}
탭 10.1과 다른 점은 무엇입니까?
는 (IP 반환 - FE80 :: be47 : 60fF을 : FEFF : 21e2)요구를 IP 주소로 이것이 내가 내 응용 프로그램에 연결하는 PC의 터미널에 전달 무엇으로.
질문에 "편지와 숫자가 이상한 형식으로"추가 할 수 있습니까? IPv6 주소 일 수도 있습니다. –
은 질문 하단에 추가되었습니다. –
http://en.wikipedia.org/wiki/Link-local_address –