|
@@ -138,7 +138,7 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { |
|
|
// 从缓存获取SDBP-AST-EPH星历数 |
|
|
// 从缓存获取SDBP-AST-EPH星历数 |
|
|
//if (Integer.parseInt(starsAsycServerPort) == channel.localAddress().getPort()) { |
|
|
//if (Integer.parseInt(starsAsycServerPort) == channel.localAddress().getPort()) { |
|
|
//if (AST_POS_CMD.equals(recvmg)) { |
|
|
//if (AST_POS_CMD.equals(recvmg)) { |
|
|
if (AST_POS_CMD.equals(msg)) { |
|
|
|
|
|
|
|
|
if (AST_EPH_CMD_BYTE.equals(msg)) { |
|
|
channelAns = nettyServerHandler.dipperDataAsyncTaskService.getAstEPH(); |
|
|
channelAns = nettyServerHandler.dipperDataAsyncTaskService.getAstEPH(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -146,29 +146,15 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { |
|
|
if (channelAns != null) { |
|
|
if (channelAns != null) { |
|
|
buf = Unpooled.buffer(channelAns.getBytes().length); |
|
|
buf = Unpooled.buffer(channelAns.getBytes().length); |
|
|
buf.writeBytes(channelAns.getBytes("GBK")); |
|
|
buf.writeBytes(channelAns.getBytes("GBK")); |
|
|
|
|
|
ctx.writeAndFlush(buf); |
|
|
} |
|
|
} |
|
|
// 最后把SDBP-AST-TIME、SDBP-AST-POS、SDBP-AST-EPH并包一起发给设备。 |
|
|
// 最后把SDBP-AST-TIME、SDBP-AST-POS、SDBP-AST-EPH并包一起发给设备。 |
|
|
// 设备采用16进制获取数据,则代理服务器也是采用16进制返回数据。 |
|
|
// 设备采用16进制获取数据,则代理服务器也是采用16进制返回数据。 |
|
|
// 通知客户端链消息发送成功 |
|
|
// 通知客户端链消息发送成功 |
|
|
ctx.writeAndFlush(buf); |
|
|
|
|
|
//ctx.write("你也好哦"); |
|
|
//ctx.write("你也好哦"); |
|
|
//ctx.flush(); |
|
|
//ctx.flush(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// @Override |
|
|
|
|
|
// public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) |
|
|
|
|
|
// throws Exception { |
|
|
|
|
|
// if (msg instanceof HttpRequest) { |
|
|
|
|
|
// HttpRequest mReq = (HttpRequest) msg; |
|
|
|
|
|
// String clientIP = mReq.headers().get("X-Forwarded-For"); |
|
|
|
|
|
// if (clientIP == null) { |
|
|
|
|
|
// InetSocketAddress insocket = (InetSocketAddress) ctx.channel() |
|
|
|
|
|
// .remoteAddress(); |
|
|
|
|
|
// clientIP = insocket.getAddress().getHostAddress(); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 发生异常触发 |
|
|
* 发生异常触发 |
|
|
*/ |
|
|
*/ |
|
|