@@ -527,6 +527,7 @@ public class MsgDecoder {
}
}else {
+ additionalInfo = Arrays.copyOfRange(additionalInfo, length + 2, additionalInfo.length);
break;
@@ -171,7 +171,7 @@ public class BSJGpsServerHandler extends HexBinaryAcceptanceHandlerAdapter {
ch.pipeline().addLast(new DelimiterBasedFrameDecoder(1204,
Unpooled.copiedBuffer(splitBytes1), Unpooled.copiedBuffer(splitBytes2)));
- ch.pipeline().addLast(this);
+ ch.pipeline().addLast(BSJGpsServerHandler.this);
}).option(ChannelOption.SO_BACKLOG, 128).childOption(ChannelOption.SO_KEEPALIVE, true);
@@ -269,7 +269,7 @@ public class YiTongGpsServerHandler extends HexBinaryAcceptanceHandlerAdapter {
protected void initChannel(SocketChannel ch) throws Exception {
ch.pipeline()
.addLast(new DelimiterBasedFrameDecoder(65535, Unpooled.copiedBuffer(splitBytes)));
+ ch.pipeline().addLast(YiTongGpsServerHandler.this);
ChannelFuture f = b.bind(port).sync();
@@ -171,7 +171,7 @@ public class YuGuangGpsServerHandler extends HexBinaryAcceptanceHandlerAdapter {
+ ch.pipeline().addLast(YuGuangGpsServerHandler.this);
@@ -41,6 +41,8 @@ public class HelloClient {
public static void main(String[] args) throws Exception {
+
HelloClient client = new HelloClient();
@@ -53,7 +55,7 @@ public class HelloClient {
singleThreadPool.execute(()->{
try {
- client.connect("localhost", 7009);
+ client.connect("localhost", 6707);
Thread.sleep(5000);
} catch (Exception e) {
// TODO Auto-generated catch block
@@ -62,7 +62,12 @@ public class HelloClientIntHandler extends ChannelInboundHandlerAdapter {
// msg= DatatypeConverter.parseHexBinary(a);
// String msg = "n,2,860854021358527,2018-03-21,12:00:20,31.888678,117.480155,0.025002,9942.554893,111.110001,z00575.675,s00107.600,f00000.000,t00000.000,x0062,e0,g0,m0,v0,N0,p0000,k0000000000";
// msg=msg+"\n";
- msg=message.getBytes();
+ String msg1 = "7e02000071010000000001000D00000000000C00130244F55F06D18611005C0000000018040917290301040003019603020000E80100FC3A01020000020C002BDA7D0100176BB000146ECD030C00930AC10083E360000F2761040800000000000004B0050200000604001DB8B30704000000142B044C3F004330011C310115497e";
+ msg= DatatypeConverter.parseHexBinary(msg1);
+ String printHexBinary = DatatypeConverter.printHexBinary(msg);
+ System.out.println(printHexBinary);
+ // msg=message.getBytes();
ByteBuf encoded = ctx.alloc().buffer(4 * msg.length);
encoded.writeBytes(msg);
ctx.write(encoded);