Netty socket.io 启用Epoll 模式异常

news/2024/7/9 18:31:43 标签: epoll, netty, 操作系统

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") > -1) {
            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.13</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.0</version>
        </dependency>

        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
            <version>4.1.16.Final</version>
        </dependency>

 

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

 

处理方式

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

 

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

 

转载于:https://www.cnblogs.com/eason-d/p/9707986.html


http://www.niftyadmin.cn/n/1472022.html

相关文章

【NOIP2016提高A组五校联考1】道路规划

题目 分析 我们考虑&#xff0c;当现在有一个合法的集合时&#xff0c;如何往里面增加一个点&#xff0c;使这个集合仍然合法。 假设现在有一个合法的集合&#xff0c; 那么当我们加入一个点&#xff0c;它的道路穿过来整个集合&#xff0c;那么 然后搞一遍最长下降子序列就可以…

git log 获取构建时间_如何生成changelog:自从上次Hudson构建以来,git log?

takehin的答案是正确的,如果您有权访问build.xml文件,但这可能会中断,特别是如果您在从属节点上构建(因为从站没有引用的build.xml).不要害怕,因为您可以通过Jenkins直接访问此信息,使用其远程访问api&#xff1a;例如&#xff1a;http:///jenkins/job//lastSuccessfulBuild/ap…

【JAVA】Java 开发环境配置(WIndows篇)

个人主页&#xff1a;【&#x1f60a;个人主页】 系列专栏&#xff1a;【初始JAVA】 文章目录 前言下载JDK配置环境变量JAVA_HOME 设置PATH设置CLASSPATH 设置变量设置参数 前言 在前篇中我们介绍了JAVA语言的诞生与发展&#xff0c;现在是时候去学习使用他们了。 下载JDK 首先…

linux mysql5.6.17_Linux下mysql 5.6.17安装图文教程详细版

linux安装mysql服务分两种安装方法&#xff1a;①源码安装&#xff0c;优点是安装包比较小&#xff0c;只有十多M&#xff0c;缺点是安装依赖的库多&#xff0c;安装编译时间长&#xff0c;安装步骤复杂容易出错&#xff1b;②使用官方编译好的二进制文件安装&#xff0c;优点是…

MYSQL进阶学习笔记十五:MySQL 的账号权限赋予!(视频序号:进阶_33,34)

知识点十六&#xff1a;MySQL的账号权限赋予(33) 一、MySQL权限简介 关于mysql的权限简单的理解就是mysql允许你做你全力以内的事情&#xff0c;不可以越界。比如只允许你执行select操作&#xff0c;那么你就不能执行update操作。只允许你从某台机器上连接mysql&#xff0c;那么…

centos安装mysql5.1_CentOS 6.9安装MySQL 5.1.73

分享在CentOS 6.9环境中安装MySQL 5.1.73 数据库&#xff0c;希望对大家有所帮助。1、确认mysql是否已安装&#xff0c;有下面的代码可知[rootcdh1 linuxidc]# yum list installed mysql*Loaded plugins: fastestmirror, refresh-packagekit, securityLoading mirror speeds fr…

python应用-matplotlib绘图

详细内容参看&#xff1a;官网 测试数据&#xff1a; # 传入的参数 x[1,2,3,4,5] squares[1,4,9,16,25] 简单的绘图 import matplotlib.pyplot as pltdef plot1(x,squares): """plot simple pic"""plt.plot(x,squares,linewidth1)# or plt.…

Beta阶段——第1篇 Scrum 冲刺博客

第1篇 Scrum 冲刺博客 a. 介绍小组新加入的成员&#xff0c;Ta担任的角色。 新加入成员郭炜埕原先担任的角色前端界面设计现在担任的角色前端开发,并协助后端开发新加成员介绍炜埕同学对界面设计有一定的兴趣&#xff0c;设计的界面美观&#xff0c;和我们一样也有强迫症。她在…