Javatpoint Logo

how can i get different client systems mac addresses in a web application using java with browser compatability

By: sriniv*** On: Wed Nov 02 18:13:07 IST 2016     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
i tried to get different client systems MAC addresses who are accessing my application...but i got only one address MAC (server system) all the time..

below code:

InetAddress ip = InetAddress.getLocalHost();
Enumeration<NetworkInterface> networks = NetworkInterface.getNetworkInterfaces();
while (networks.hasMoreElements()) {
NetworkInterface network = networks.nextElement();
byte[] mac = network.getHardwareAddress();
if (mac != null) {
System.out.print("Current MAC address : ");
StringBuilder sb = new StringBuilder();
for (int i = 0; i < mac.length; i++) {
sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : ""));
}
System.out.println(sb.toString());
}
}

output: single MAC Address ( Server MAC Address)

But the problem is i want different MAC address of different client systems who are accesssing my application...will you please help me..Thank you from srinivas

Up0Down