| | |
| | | package com.zy.core.thread; |
| | | |
| | | import com.core.common.Cools; |
| | | import com.zy.core.News; |
| | | import com.zy.core.Slave; |
| | | import com.zy.core.ThreadHandler; |
| | | import lombok.Data; |
| | |
| | | socket.connect(socketAddress, 1000); //某些服务器ping延迟高时要增加,否则会报错connect timeout |
| | | dataOutputStream = new DataOutputStream(socket.getOutputStream()); |
| | | dataInputStream = new DataInputStream(socket.getInputStream()); |
| | | // log.info("条码扫描仪连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | // News.info("条码扫描仪连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } catch (Exception e) { |
| | | socket = null; |
| | | log.error("磅秤扫描仪连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | News.error("磅秤扫描仪连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | return false; |
| | | } |
| | | return true; |
| | |
| | | } |
| | | socket = null; |
| | | } catch (IOException e) { |
| | | log.error("SocketClient close Exception:" + e.getMessage()); |
| | | News.error("SocketClient close Exception:" + e.getMessage()); |
| | | } |
| | | } |
| | | |