diff --git a/pqs-device/device-boot/pom.xml b/pqs-device/device-boot/pom.xml index ff807b7c4..d881e47d5 100644 --- a/pqs-device/device-boot/pom.xml +++ b/pqs-device/device-boot/pom.xml @@ -21,16 +21,16 @@ - - - - - + com.njcn + pq-device-boot + ${project.version} + + com.njcn diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/utils/SocketClientComm.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/utils/SocketClientComm.java index fc2987b8b..85c778f4f 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/utils/SocketClientComm.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/utils/SocketClientComm.java @@ -6,10 +6,7 @@ import lombok.extern.slf4j.Slf4j; import net.sf.json.JSONObject; import org.springframework.stereotype.Component; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; +import java.io.*; import java.net.InetSocketAddress; import java.net.Socket; import java.nio.charset.StandardCharsets; @@ -72,31 +69,7 @@ public class SocketClientComm { e.printStackTrace(); }finally{ - //一些必要的清理工作 - if(in != null){ - try { - in.close(); - } catch (IOException e) { - e.printStackTrace(); - } - in = null; - } - if(out != null){ - try { - out.close(); - } catch (IOException e) { - e.printStackTrace(); - } - out = null; - } - if(socket != null){ - try { - socket.close(); - } catch (IOException e) { - e.printStackTrace(); - } - socket = null; - } + //System.out.println("end---"); } @@ -104,4 +77,35 @@ public class SocketClientComm { } + + + private void safeCloseStream(InputStream in,OutputStream out,Socket socket){ + //一些必要的清理工作 + if(in != null){ + try { + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + in = null; + } + if(out != null){ + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + out = null; + } + if(socket != null){ + try { + socket.close(); + } catch (IOException e) { + e.printStackTrace(); + } + socket = null; + } + } + + }