socket
This commit is contained in:
parent
68cd2578b5
commit
0f1f36a5f3
@ -104,7 +104,10 @@ public class RemoteControllerProcessor {
|
||||
|
||||
String[] split = dto.getRobotIp().split("\\.");
|
||||
for (String ipItem : split) {
|
||||
String hex = Integer.toHexString(Integer.valueOf(ipItem));
|
||||
String hex = Integer.toHexString(Integer.valueOf(ipItem)).toUpperCase();
|
||||
if (hex.length()==1){
|
||||
hex = 0 + hex;
|
||||
}
|
||||
msg = msg + " " + hex;
|
||||
log.info("组装 :{}", hex);
|
||||
}
|
||||
|
@ -37,23 +37,19 @@ public class TCPServerApplicationRunner implements ApplicationRunner {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
InputStream is=socket.getInputStream();
|
||||
byte[] bytes=new byte[1024];
|
||||
int len=is.read(bytes);
|
||||
System.out.println(new String(bytes,0,len));
|
||||
log.info("服务端收到的数据 :{}",new String(bytes,0,len));
|
||||
OutputStream os= socket.getOutputStream();
|
||||
//响应给客户端
|
||||
os.write("socket :".getBytes());
|
||||
os.write("server :".getBytes());
|
||||
socket.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}).start();
|
||||
log.info("初始化socket服务完成");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
package cn.iocoder.yudao.module.remote.util.crc;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author lwt
|
||||
* @date 2018-06-26
|
||||
*
|
||||
* <p>
|
||||
* CRC16校验码计算
|
||||
* <p>
|
||||
* (1).预置1个16位的寄存器为十六进制FFFF(即全为1),称此寄存器为CRC寄存器;
|
||||
|
@ -54,9 +54,9 @@ logging:
|
||||
|
||||
remote:
|
||||
cockpit: # 远遥控制车辆IP和端口
|
||||
- controllerPort: 9006
|
||||
controllerIp: 10.10.5.26
|
||||
ipcIp: 10.10.5.26
|
||||
- controllerPort: 9000
|
||||
controllerIp: 127.0.0.1
|
||||
ipcIp: 10.10.7.132
|
||||
msg: AA 55 13 04 01 88 88 # 驾舱socket头信息
|
||||
cockpit-time-out: 120 # 驾舱超时报警时间
|
||||
industrial-control-time-out: 120 # 工控通信超时报警时间
|
||||
|
Loading…
Reference in New Issue
Block a user