parnian~parnian
جمعه 05 مهر 1392, 21:37 عصر
سلام دوستان
من برای گرفتن مک ادرس سیستم از تکه کد زیر استفاده می کنم :
private static String getMacAddress() throws IOException {
String command = "ipconfig /all";
Process pid = Runtime.getRuntime().exec(command);
BufferedReader in = new BufferedReader(new InputStreamReader(pid.getInputStream()));
Pattern p = Pattern.compile(".*Physical Address.*: (.*)");
while (true) {
String line = in.readLine();
if (line == null)
break;
Matcher m = p.matcher(line);
if (m.matches()) {
return m.group(1);
}
}
return "";
}
ولی مشکل اینه وقتی به اینترنت وصل باشه مک ادرس رو نمیده .......... کسی از دوستان می دونه چطوری میشه وقتی سیستم به اینترنت وصله مک ادرس سیستم رو گرفت ؟
من برای گرفتن مک ادرس سیستم از تکه کد زیر استفاده می کنم :
private static String getMacAddress() throws IOException {
String command = "ipconfig /all";
Process pid = Runtime.getRuntime().exec(command);
BufferedReader in = new BufferedReader(new InputStreamReader(pid.getInputStream()));
Pattern p = Pattern.compile(".*Physical Address.*: (.*)");
while (true) {
String line = in.readLine();
if (line == null)
break;
Matcher m = p.matcher(line);
if (m.matches()) {
return m.group(1);
}
}
return "";
}
ولی مشکل اینه وقتی به اینترنت وصل باشه مک ادرس رو نمیده .......... کسی از دوستان می دونه چطوری میشه وقتی سیستم به اینترنت وصله مک ادرس سیستم رو گرفت ؟