我正在使用 jssc 与设备进行通信。
在 Windows 和 Linux 中,该程序还可以,但我遇到了病毒问题,我格式化了我的电脑,然后该程序无法在 Windows 上运行,但在 Linux 上该程序运行良好。
我不知道为什么程序停止工作。
程序代码为:
try {
command = new String(commandSend);
serialPort.writeBytes(command.getBytes());
logger.info("Sending to port " + a.getPort() + " " + command);
Thread.sleep(1000);//Wait 0.8 seconds
retorno = serialPort.readString();
} catch (Exception e) {
logger.error("Problems with send/receive command with the analyzer");
logger.error(e.getMessage());
logger.error(e.toString());
e.printStackTrace();
}