Explorar el Código

修改读取的结果

tags/v1.0.0^2
林万龙 hace 4 años
padre
commit
6b6f2b23ba
Se han modificado 1 ficheros con 12 adiciones y 9 borrados
  1. +12
    -9
      src/main/java/com/telpo/dipperposition/common/SocketClient.java

+ 12
- 9
src/main/java/com/telpo/dipperposition/common/SocketClient.java Ver fichero

@@ -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());


Cargando…
Cancelar
Guardar