Pārlūkot izejas kodu

修改读取的结果

tags/v1.0.0^2
林万龙 pirms 4 gadiem
vecāks
revīzija
6b6f2b23ba
1 mainītis faili ar 12 papildinājumiem un 9 dzēšanām
  1. +12
    -9
      src/main/java/com/telpo/dipperposition/common/SocketClient.java

+ 12
- 9
src/main/java/com/telpo/dipperposition/common/SocketClient.java Parādīt failu

@@ -54,22 +54,25 @@ public class SocketClient {
InputStream is=socket.getInputStream();
BufferedReader br=new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));

String ackResult="";
String ackHexOut = HexConvert.convertStringToHex(ackAckCheckRef);
while(!((reply=br.readLine())==null)){
log.debug("接收服务器的信息:"+reply);
if (ackHexOut.equals(reply)) {
reply=br.readLine();
ackResult = HexConvert.convertHexToString(reply);
break;
}
StringBuffer ackResultBuf= new StringBuffer();
//String ackHexOut = HexConvert.convertStringToHex(ackAckCheckRef);
reply=br.readLine();
while(reply!=null){
//log.debug("接收服务器的信息:"+reply);
//if (ackHexOut.equals(reply)) {
ackResultBuf.append(reply);
reply=br.readLine();
// break;
//}
}
String ackResult = HexConvert.convertHexToString(ackResultBuf.toString());
//4.关闭资源
br.close();
is.close();
pw.close();
os.close();
log.debug(ackResult);
log.debug("接收服务器的信息:"+ackResult);
return ackResult;
} catch (IOException e) {
log.error("Socket sendCmd Error:" + e.getMessage());


Notiek ielāde…
Atcelt
Saglabāt