rev 更新单工ndc连接

This commit is contained in:
wangs
2023-08-18 16:03:45 +08:00
parent 9f7789abc9
commit 908c8ed7c8

View File

@@ -23,6 +23,7 @@ import org.springframework.stereotype.Component;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.Date;
import java.util.List;
@@ -65,9 +66,16 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
try {
String ip = paramService.findByCode(AcsConfig.ONEAGVURL).getValue();
int port = Integer.parseInt(paramService.findByCode(AcsConfig.ONEAGVPORT).getValue());
socket = new Socket(ip, port);
InetSocketAddress socketAddress = new InetSocketAddress(ip, port);
socket = new Socket();
socket.connect(socketAddress,2*1000);
socket.setKeepAlive(true);//长链接
// s.setSoTimeout(1000* 60 * 10);//读取超时时间
dos = new DataOutputStream(socket.getOutputStream());
dis = new DataInputStream(socket.getInputStream());
byte[] bytes = new byte[256];
int count;
int[] arr;