Commit 00ad4d86 authored by 赵啸非's avatar 赵啸非

修改消息组件

parent da54c2c1
......@@ -29,7 +29,7 @@ public class NettyStartedService implements IApplicationStartedService {
public void start() {
logger.info("开始netty服务....");
thread = new Thread(() -> {
controlServer.run(7788);
controlServer.run(61112);
});
thread.setDaemon(true);
thread.start();
......
......@@ -28,12 +28,11 @@ public class UDPClientHandler extends SimpleChannelInboundHandler<DatagramPacket
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
log.info("remoteAddress:{}", ctx.channel().remoteAddress());
ctx.executor().parent().execute(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 10; i++) {
log.info("send msg:{}",i);
ctx.writeAndFlush(new DatagramPacket(Unpooled.copiedBuffer("我在广播" + i, Charset.forName("utf-8")),
new InetSocketAddress("255.255.255.255", 7788)));
try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment