
IO
IO
热爱技术的小陈
于上市互联网企业工作十来年,从程序员到技术总监,从.net到php到java再到大数据,喜欢研究新技术
展开
-
手写DubboRPC
手写DubboRPC原创 2022-01-21 20:00:25 · 323 阅读 · 0 评论 -
RPC基本介绍
RPC基本介绍原创 2022-01-21 10:46:12 · 3293 阅读 · 0 评论 -
Netty 异步线程池Context方式
EchoClient/* * Copyright 2012 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the L原创 2022-01-21 10:37:00 · 2512 阅读 · 0 评论 -
Netty 异步线程池handler方式
EchoClient/* * Copyright 2012 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the L原创 2022-01-21 10:35:19 · 321 阅读 · 0 评论 -
Netty 异步线程池 handler与context方式对比
handler与context方式对比原创 2022-01-20 15:19:55 · 385 阅读 · 0 评论 -
Netty 阻塞线程池案例
案例结果,都是添加到同个线程EchoServerpublic final class EchoServer { static final boolean SSL = System.getProperty("ssl") != null; static final int PORT = Integer.parseInt(System.getProperty("port", "8007")); public static void main(String[] args) thro原创 2022-01-20 13:15:55 · 697 阅读 · 0 评论 -
Netty 开发文档
Netty 开发文档 https://netty.io/4.1/api/index.html原创 2022-01-14 20:07:55 · 1597 阅读 · 0 评论 -
Netty源码解读
Netty源码解读原创 2022-01-14 19:55:20 · 422 阅读 · 0 评论 -
如何解决TCP粘包与拆包
TCP粘包与拆包解决方案原创 2022-01-14 19:45:00 · 510 阅读 · 0 评论 -
模拟TCP粘包拆包问题
官网下载https://netty.io/下载完后解压,用IDEA打开,example中都是案例echo为最常规“客户端-服务端”案例原创 2022-01-14 14:59:12 · 333 阅读 · 0 评论 -
什么是TCP粘包与拆包
TCP粘包与拆包基本介绍原创 2022-01-14 13:04:35 · 1175 阅读 · 0 评论 -
Netty入站出站机制与编码解码器
入站出站机制编码解码器解码器ByteToMessageDecoder原创 2022-01-14 10:34:16 · 183 阅读 · 0 评论 -
Java Protobuf 多类型实例
maven 中心找到protobuf坐标 https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> &原创 2022-01-13 22:00:28 · 401 阅读 · 0 评论 -
Java Protobuf 单类型实例
maven 中心找到protobuf坐标 https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> &原创 2022-01-13 17:49:16 · 189 阅读 · 0 评论 -
Protobuf怎么使用
下载解压官网 https://github.com/protocolbuffers/protobuf/releases 找到java版本(找到自己需要的语言)把要编译的文件拷入bin目录中Student.protosyntax = "proto3";//版本option java_outer_classname = "StudentPOJO";//生成的外部类名,同时也是文件名//protobuf 使用message 管理数据message Student{//会在Student外部类生成一原创 2022-01-13 17:39:17 · 809 阅读 · 0 评论 -
websocket socket xmpp区别
socket是套接字,在你的语境下,多指传输层网络接口。webSocket,是一个应用层协议,说的是,目前浏览器实现的一套通信协议,用来解决之前HTTP,请求响应模型不合适的场合。XMPP,是一个应用层协议,协议基于XML结构设计...原创 2022-01-13 16:37:23 · 1123 阅读 · 0 评论 -
OSI七层网络模型
原创 2022-01-13 16:23:36 · 652 阅读 · 0 评论 -
HTTP、websocket、XMPP、COAP、MQTT和DDS协议对比
对于物联网,最重要的是在互联网中设备与设备的通讯,现在物联网在internet通信中比较常见的通讯协议包括:HTTP、websocket、XMPP、COAP、MQTT1、HTTP和websocket在互联网时代,TCP/IP协议已经一统江湖,现在的物联网的通信架构也是构建在传统互联网基础架构之上。在当前的互联网通信协议中,HTTP协议由于开发成本低,开放程度高,几乎占据大半江山,所以很多厂商在构建物联网系统时也基于http协议进行开发。包括google主导的physic web项目,都是期望在传统web原创 2022-01-13 16:07:42 · 656 阅读 · 0 评论 -
长轮询与长连接
长轮询客户端向服务器发送Ajax请求,服务器接到请求后hold住连接,直到有新消息才返回响应信息并关闭连接,客户端处理完响应信息后再向服务器发送新的请求。优点:在无消息的情况下不会频繁的请求,耗费资源小。缺点:服务器hold连接会消耗资源,返回数据顺序无保证,难于管理维护。实例:WebQQ、Hi网页版、Facebook IM。长连接在页面里嵌入一个隐蔵iframe,将这个隐蔵iframe的src属性设为对一个长连接的请求或是采用xhr请求,服务器端就能源源不断地往客户端输入数据。优点:消息即时原创 2022-01-13 15:43:53 · 1976 阅读 · 0 评论 -
Protobuf机制简介
原创 2022-01-11 11:15:16 · 331 阅读 · 0 评论 -
Netty编码与解码
Netty编码与解码原创 2022-01-10 21:43:28 · 297 阅读 · 0 评论 -
Netty websocket长连接
Netty websocket长连接原创 2022-01-10 21:37:32 · 839 阅读 · 0 评论 -
Netty心跳包
空闲状态的处理器IdleStateHandler(3, 5, 7, TimeUnit.SECONDS)readerIdleTime 多长时间没有读操作,就会发送心跳包检测是否连接writerIdleTime 多长时间没有写操作,就会发送心跳包检测是否连接allIdleTime 多长时间没有读写操作,就会发送心跳包检测是否连接当IdleStateHandler触发就会传递给管道下一个Handler去处理,触发下一个Handler的UserEventTiggered,在该方法中去处理IdleState原创 2022-01-10 19:30:15 · 640 阅读 · 0 评论 -
基于Netty多人聊天室
服务端public class Server { private final int port; public Server(int port) { this.port = port; } public void run() { //创建两个事件循环组,bossGroup只处理连接请求,workGroup处理客户端业务处理,交给bossGroup //两个都是无线循环 //默认CPU核*2原创 2022-01-10 17:22:01 · 443 阅读 · 0 评论 -
Netty工具类Unpooled与缓冲区ByteBuf
Unpooled工具类原创 2022-01-10 10:15:55 · 1234 阅读 · 0 评论 -
Netty核心组件EventLoopGroup
EventLoopGroup与实现类NioEventLoopGroup原创 2022-01-10 10:15:36 · 264 阅读 · 0 评论 -
Netty核心组件ChannelOption
ChannelOption组件原创 2022-01-10 10:15:17 · 151 阅读 · 0 评论 -
Netty核心组件ChannelHandlerContext
ChannelHandlerContext组件原创 2022-01-10 10:14:57 · 183 阅读 · 0 评论 -
Netty核心组件Pipeline与ChannelPipeline
ChannelPipeline重点组件原创 2022-01-10 10:14:39 · 277 阅读 · 0 评论 -
Netty核心组件ChannelHandler
ChannelHandler组件原创 2022-01-10 10:14:25 · 162 阅读 · 0 评论 -
Netty核心组件Selector
Selector组件原创 2022-01-09 19:35:27 · 168 阅读 · 0 评论 -
Netty核心组件Channel
Channel组件原创 2022-01-09 19:30:01 · 212 阅读 · 0 评论 -
Netty核心组件Future与ChannelFuture
Future与ChannelFuture原创 2022-01-09 19:27:33 · 190 阅读 · 0 评论 -
Netty核心组件Bootstrap与ServerBootstrap
Bootstrap与ServerBootstrap原创 2022-01-09 19:20:33 · 428 阅读 · 0 评论 -
基于Netty的http服务器
Serverpublic class Server { public static void main(String[] args) throws InterruptedException { //创建两个事件循环组,bossGroup只处理连接请求,workGroup处理客户端业务处理,交给bossGroup //两个都是无线循环 //默认CPU核*2 EventLoopGroup bossGroup = new NioEventL原创 2022-01-09 19:16:51 · 845 阅读 · 0 评论 -
Netty异步模型Future-Listener机制
链式处理每一步都有handler进行监听callback或future服务端代码addListener其他模块与下列连接一致https://blog.youkuaiyun.com/weixin_44371237/article/details/122391777?spm=1001.2014.3001.5501public class Server { public static void main(String[] args) throws InterruptedException { ...原创 2022-01-09 16:57:36 · 648 阅读 · 0 评论 -
Netty ScheduledTaskQueue定时任务队列怎么用
服务端处理器,其他模块与下列案例一致public class ServerHandler extends ChannelInboundHandlerAdapter { //当通道有读事件,会触发 //ChannelHandlerContext上下文,含有管道pipeline与通道channel //Object msg 通道数据 @Override public void channelRead(ChannelHandlerContext ctx, Object m原创 2022-01-09 16:18:33 · 604 阅读 · 0 评论 -
Netty TaskQueue普通任务队列怎么用
服务端处理器,其他模块与下列案例一致https://blog.youkuaiyun.com/weixin_44371237/article/details/122391777?spm=1001.2014.3001.5501channelRead一旦被阻塞会影响channelReadComplete,采用TaskQueue,就可以把channelReadComplete先返回public class ServerHandler extends ChannelInboundHandlerAdapter { /原创 2022-01-09 15:56:51 · 392 阅读 · 0 评论 -
基于Netty单人聊天系统
官网https://netty.io/downloads.htmlNetty开发文档https://netty.io/4.1/api/index.html添加依赖官网的依赖不能用,就到maven仓库搜索netty,选择io.netty,最新的一个选择版本4pom.xml <dependency> <groupId>io.netty</groupId> <artifactId>ne原创 2022-01-09 14:36:25 · 563 阅读 · 0 评论 -
MINA与Netty对比
相同之处mina与netty都是Trustin Lee的作品,所以在很多方面都十分相似,他们线程模型也是基本一致,采用了Reactors in threads模型,即Main Reactor + Sub Reactors的模式。由main reactor处理连接相关的任务:accept、connect等,当连接处理完毕并建立一个socket连接(称之为session)后,给每个session分配一个sub reactor,之后该session的所有IO、业务逻辑处理均交给了该sub reactor。每原创 2022-01-08 19:35:28 · 5004 阅读 · 0 评论