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