2011-05-09 3 views

답변

0
  //InetAddress address = InetAddress.getLocalHost(); 
      InetAddress address = InetAddress.getByName("192.168.46.53"); 

      /* 
      * Get NetworkInterface for the current host and then read the 
      * hardware address. 
      */ 
      NetworkInterface ni = NetworkInterface.getByInetAddress(address); 
      if (ni != null) { 
       byte[] mac = ni.getHardwareAddress(); 
       if (mac != null) { 
        /* 
        * Extract each array of mac address and convert it to hexa with the 
        * following format 08-00-27-DC-4A-9E. 
        */ 
        for (int i = 0; i < mac.length; i++) { 
         System.out.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : ""); 
        } 
       } else { 
        // Address doesn't exist or is not accessible. 
       } 
      } else { 
       // Network Interface for the specified address is not found. 
      } 
+0

어떻게 클라이언트의 MAC 주소를 JSP로 얻을 수 있습니까? –

+1

코드 뒤에이 스 니펫을 사용하십시오 .... –

+0

어떻게 하시겠습니까? 여기에 새로운 .... –

관련 문제