Commit bbbfbcb6 authored by wanghao's avatar wanghao

1 每次读取后 关闭 socket连接

parent 16a45a69
......@@ -34,13 +34,18 @@ public class ReceiverThread extends Thread {
// 将接收到的字节转换为十六进制字符串显示
hexResponse = HexUtils.bytesToHex(responseBytes);
log.info("收到服务器响应: " + hexResponse);
if(hexResponse.length() == 58) {
socket.close();
if(hexResponse.length() >= 58) {
break;
}
}
log.info("解析完了啊啊啊啊啊: " + hexResponse);
} catch (IOException e) {
log.error("接收数据失败: " + e.getMessage());
} finally {
try {
socket.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment