socket连接

This commit is contained in:
cbs 2025-05-22 17:19:04 +08:00
parent dc4a221b20
commit 5507e49ff7
2 changed files with 6 additions and 3 deletions

View File

@ -77,7 +77,8 @@ public class RemoteControllerProcessor {
remoteControllerSocketDTO.setControllerPort(cockpitPort); remoteControllerSocketDTO.setControllerPort(cockpitPort);
Socket socket = new Socket(); Socket socket = new Socket();
try { try {
socket.connect(new InetSocketAddress(cockpitIp, cockpitPort), 1000); socket.setKeepAlive(true);
socket.connect(new InetSocketAddress(cockpitIp, cockpitPort), 500);
remoteControllerSocketDTO.setSocket(socket); remoteControllerSocketDTO.setSocket(socket);
} catch (IOException e) { } catch (IOException e) {
log.error("添加socket失败 :{}", e); log.error("添加socket失败 :{}", e);
@ -153,6 +154,8 @@ public class RemoteControllerProcessor {
if (socket == null || socket.isClosed()) { if (socket == null || socket.isClosed()) {
try { try {
socket = new Socket(); socket = new Socket();
log.info("连接新的的socket");
socket.setKeepAlive(true);
socket.connect(new InetSocketAddress(cockpitIp, cockpit.getControllerPort()), 1000); socket.connect(new InetSocketAddress(cockpitIp, cockpit.getControllerPort()), 1000);
} catch (IOException e) { } catch (IOException e) {
log.error("连接socket出现异常 :{}", cockpitIp); log.error("连接socket出现异常 :{}", cockpitIp);

View File

@ -526,12 +526,12 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
throw exception(TASK_CHECK_HAVE_DOING_TASK); throw exception(TASK_CHECK_HAVE_DOING_TASK);
} }
List<String> commandTypes = PathTaskTypeEnum.getMistakeTaskTypes(); /*List<String> commandTypes = PathTaskTypeEnum.getMistakeTaskTypes();
List<RobotTaskDetailActionLogDO> actionLogDOList = taskDetailActionLogMapper.getMistakeTaskByCommandType(commandTypes); List<RobotTaskDetailActionLogDO> actionLogDOList = taskDetailActionLogMapper.getMistakeTaskByCommandType(commandTypes);
if (ObjectUtil.isNotEmpty(actionLogDOList)) { if (ObjectUtil.isNotEmpty(actionLogDOList)) {
log.info("编辑地图存在未完成的移动到等待点/自动充电任务"); log.info("编辑地图存在未完成的移动到等待点/自动充电任务");
throw exception(TASK_CHECK_HAVE_DOING_TASK); throw exception(TASK_CHECK_HAVE_DOING_TASK);
} }*/
} }
/** /**