Epoll 环境为Linux 内核2.6 以上版本  Windows下不能启动

1:判断Linux环境

  public static boolean isOSLinux() {
Properties prop = System.getProperties();
String os = prop.getProperty("os.name");
System.out.println(os);
if (os != null && os.toLowerCase().indexOf("linux") > -) {
return true;
} else {
return false;
}
}   
  if(isOSLinux()){
  //使用Linux Epoll模型
  log.info("启用Epoll");
  config.setUseLinuxNativeEpoll(true);
  }
 

2:pom.xml配置

参考地址: https://www.jianshu.com/p/bb3718226f36

<dependency>
<groupId>com.corundumstudio.socketio</groupId>
<artifactId>netty-socketio</artifactId>
<version>1.7.</version>
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transpor</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-resolver</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
</exclusion>
</exclusions>
</dependency> <!-- 客户端 -->
<dependency>
<groupId>io.socket</groupId>
<artifactId>socket.io-client</artifactId>
<version>1.0.</version>
</dependency> <dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1..Final</version>
</dependency>

3:启动成功后如图,有一个异常警告

处理方式

参考地址: https://github.com/robymus/netty-socketio/commit/fcc7d33df843eb2720529540ac1c37ffa0e262a4

4: SO_LINGER 什么意思呢,
参考地址: https://www.jianshu.com/p/0bff7c020af2

Netty socket.io 启用Epoll 模式异常的更多相关文章

  1. 【Spring Boot】集成Netty Socket.IO通讯框架

    服务端 @Configuration public class NettySocketConfig { private static final Logger logger = LoggerFacto ...

  2. socket.io 入门教程

    转载自:http://deadhorse.me/nodejs/2011/12/29/socket.io_induction.html socket.io socket.io是一个以实现跨浏览器.跨平台 ...

  3. Linux Network IO Model、Socket IO Model - select、poll、epoll

    目录 . 引言 . IO机制简介 . 阻塞式IO模型(blocking IO model) . 非阻塞式IO模型(noblocking IO model) . IO复用式IO模型(IO multipl ...

  4. (转)Linux Network IO Model、Socket IO Model - select、poll、epoll

    Linux Network IO Model.Socket IO Model - select.poll.epoll  原文:https://www.cnblogs.com/LittleHann/p/ ...

  5. socket.io简单入门(一.实现简单的图表推送)

    引子:随着nodejs蓬勃发展,虽然主要业务系统因为架构健壮性不会选择nodejs座位应用服务器.但是大量的内部系统却可以使用nodejs试水,大量的前端开发人员转入全堆开发也是一个因素. 研究本例主 ...

  6. [转载] Linux下多路复用IO接口 epoll select poll 的区别

    原地址:http://bbs.linuxpk.com/thread-43628-1-1.html 废话不多说,一下是本人学习nginx 的时候总结的一些资料,比较乱,但看完后细细揣摩一下应该就弄明白区 ...

  7. 3高并发server:多路IO之epoll

     1 epoll epoll是Linux下多路复用IO接口select/poll的增强版本号,它能显著提高程序在大量并.发连接中仅仅有少量活跃的情况下的系统CPU利用率,由于它会复用文件描写叙述符 ...

  8. 《Linux/UNIX系统编程手册》第63章 IO多路复用、信号驱动IO以及epoll

    关键词:fasync_helper.kill_async.sigsuspend.sigaction.fcntl.F_SETOWN_EX.F_SETSIG.select().poll().poll_wa ...

  9. Linux下多路复用IO接口epoll/select/poll的区别

    select比epoll效率差的原因:select是轮询,epoll是触发式的,所以效率高. Select: 1.Socket数量限制:该模式可操作的Socket数由FD_SETSIZE决定,内核默认 ...

随机推荐

  1. Spring-framework应用程序启动loadtime源码分析笔记(二)——@Transactional

    @Transactional标识类或方法,使方法被执行时使用事务方式执行,这里只讨论PROXY方法增强方法.使用@EnableTransactionManagement,默认model=AdviceM ...

  2. 基于Html的SEO(很基础,更是前端必须掌握之点)

    文章来源:百度文库   Html代码seo优化最佳布局,实例讲解     众所周知,搜索引擎对html代码是非常优化的,所以html的优化是做好推广的第一步.一个符合seo规则的代码大体如下界面所示. ...

  3. 01-TCP/IP概述

    TCP/IP 概述 允许不同厂家的各种型号的计算机使用不同操作系统互相进行通信 真正的开放系统 "全球互联网"或"因特网"的基础 2.分层 网络协议通常分不同层 ...

  4. mongodb 的一些基本命令以及 导入、导出,待更新

    基本命令参考: https://blog.csdn.net/cckevincyh/article/details/78702674 导入导出参考:https://blog.csdn.net/djy37 ...

  5. Abp IRepository 方法解释(1)

    //    // 摘要:    //     This interface is implemented by all repositories to ensure implementation of ...

  6. TCP/IP SIGPIPE信号

    往一个已经接受FIN的套接中写是允许的,接受到FIN仅仅代表对方不再发送数据. 在收到RST段之后,如果在调用write就 会产生SIGPIPE信息,对于这个信号的处理我们通常 解决方法 signal ...

  7. CSS部分

    float属性 父级坍塌现象 <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...

  8. Hive与HBase集成进行数据分析

    我们把hive的安装包上传的节点3来 解压 现在我们还是老规矩通过notopad++来连接我们的虚拟机来配置文件,把下面这两个文件重命名一下 修改这个文件 对hive-env.sh我们修改这里 下面我 ...

  9. css实战——第一天

    1.  开发前的准备 1.1配置开发环境   sublime  webstorm  vscode  Hbuilder  atom 1.2建立项目文件夹 主页或是首页    index.html   d ...

  10. BZOJ 3473: 字符串 (广义后缀自动机)

    /* 广义后缀自动机, 每次加入维护 该right集合的set, 然后可以更新所有的parent,最终能够出现在k个串中right集合也就是set大小大于等于k的部分 这样的话就给了我们要跳的节点加了 ...