使用Netty作为服务端来实现UDP的接受
发布时间
阅读量:
阅读量
@Override
public void run(String... args) throws Exception {
new Thread(this::creatNetty).start();
}
public void creatNetty(){
try {
log.info("netty start .....");
nettyUdpBootstrapServer.startup(port);
}catch (Exception e){
log.error(e.getMessage());
}
}
}
接下启动的方式肯定要对这个接口进行实现,
接口具体包含的方法只有两个
@Component
public interface NettyUdpBootstrapServer {
// 初始化过程
void startup(int port);
// 关闭操作
void shutdown();
}
对于这个接口我先实现了一个抽象方法作为对netty适配的搭建
@Compone
全部评论 (0)
还没有任何评论哟~
