pom提交
This commit is contained in:
@@ -21,16 +21,16 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!--pq-device-boot和pms-device-boot只能选择一个-->
|
<!--pq-device-boot和pms-device-boot只能选择一个-->
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.njcn</groupId>-->
|
|
||||||
<!-- <artifactId>pq-device-boot</artifactId>-->
|
|
||||||
<!-- <version>${project.version}</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>pq-device-boot</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- <dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>pms-device-boot</artifactId>
|
<artifactId>pms-device-boot</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
|
|||||||
@@ -6,10 +6,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.*;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@@ -72,31 +69,7 @@ public class SocketClientComm {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}finally{
|
}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---");
|
//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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user