package com.xzff.web;import java.io.InputStream;import .DatagramPacket;import .DatagramSocket;import .InetAddress;import java.util.regex.Matcher;import java.util.regex.Pattern;/*** 仅限局域网使用*/public class XzffTest {public static void main(String[] args) throws Exception {guanji();// String macAddress = getMacAddress(ip);// System.out.println(macAddress);// kaiji();}/*** 执行单条指令** @param cmd 命令* @return 执行结果* @throws Exception*/public static String command(String cmd) throws Exception {Process process = Runtime.getRuntime().exec(cmd);process.waitFor();InputStream in = process.getInputStream();StringBuilder result = new StringBuilder();byte[] data = new byte[256];while (in.read(data) != -1) {String encoding = System.getProperty("sun.jnu.encoding
如果觉得《Java项目:局域网内实现中控(远程开关机)》对你有帮助,请点赞、收藏,并留下你的观点哦!