import java.net.InetAddress;Output:
import java.net.UnknownHostException;
public class Clientaddress {
public static void main(String[] args) {
문자열 호스트 이름;
문자열 주소IPLocale;
try{
InetAddress inetadr = InetAddress.getLocalHost();
//machinename
hostname = (문자열) inetadr.getHostName();
System.out.println("컴퓨터 이름 = "+호스트 이름);
//네트워크의 IP 주소
IPLocale address = (문자열) inetadr.getHostAddress();
System.out.println("로컬 IP 주소 = "+IPlOcale)
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}
Machine Name = VAIO-VAIOReferences:
Local IP Address = 192.168.1.101
Please disable your ad blocker and refresh the window to use this website.