![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Netty
文章平均质量分 77
执于代码
职业画像详情:https://github.com/xiamaocheng,
其他:https://www.infoq.cn/profile/8E8D58FE040264/publish
展开
-
Netty 执行了多次channelReadComplete()却没有执行ChannelRead()
channelReadComplete从字面看就是netty读取完数据之后要进行的操作,然而有时却并不是这样。对于channelRead方法,如果pipeline中添加了解析器,会在消息被解码后才会被调用;而channelReadComplete方法是只要底层的socket读到了bytes就会被触发一次,但是否是完整的数据它并不知道。底层的TCP不会去理解上层的业务数据,只会根据缓冲区的实际情况进行数据包的拆分或重组,所以对于一个完整的业务信息,就可能会多次调用channelReadComplete。原创 2023-07-31 21:10:45 · 764 阅读 · 0 评论 -
Netty3 和Netty4区别
Netty3 和Netty4区别。原创 2023-07-31 21:05:25 · 560 阅读 · 0 评论 -
链路模型的分析
网络爬虫的是一个非常常见的需求。原创 2023-07-29 05:41:23 · 267 阅读 · 0 评论 -
netty 809协议
netty 809协议。原创 2023-07-28 07:54:41 · 562 阅读 · 0 评论 -
809 协议相关
809 协议。原创 2023-07-26 20:28:55 · 647 阅读 · 0 评论 -
netty hander 执行顺序
hander 的执行顺序:client 中pipeline 顺序://first,add codecpipeline.addLast(new BigIntegferdecoder);pipeline.addlast(new numberEncodeer);pipeline.addLast(new FactoriesClientHander);//first.codecpipeline.addlast(new BigIntegerdecoder);pipeLine.add.原创 2020-12-06 17:57:47 · 246 阅读 · 0 评论 -
netty 做echo 服务
1.echo server :先配置SSL工厂: 配置server:/* * 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. Yo原创 2020-12-06 15:50:48 · 219 阅读 · 0 评论 -
使用netty 做dns 解析服务
概述:使用netty 做DNS解析服务:源码:1.使用netty 做一个UDPserver:netty的版本必须大度4.1.xnetty 在4.1.x 加入DNS协议final NioEventLoopGroup group = new NioEventLoopGroup();try { Bootstrap bootstrap = new Bootstrap(); bootstrap.group(group).channel(NioDatagramChannel.class)原创 2020-12-06 15:16:23 · 2146 阅读 · 0 评论 -
netty 丢弃服务
概述:netty 最简单的丢弃服务:客户端发送消息,好,发送过去了,服.务器也收到了,但是抛弃了.源码:EventLoopGroup bossGroup = new NioEventLoopGroup(1); //住循环队列设置为1个 EventLoopGroup workerGroup = new NioEventLoopGroup(); //创建的事件组循环 try { ServerBootstrap b = new .原创 2020-12-06 12:07:12 · 376 阅读 · 0 评论 -
netty 调优参数&故障诊断&优化使用&安全和集成
netty 调优参数1.Linux 调优2.Netty系统参数:---------------------------------------1.Linux 调优修改Linux对每个进程打开的文件进程打开的文件 too many file open 问题。2.Netty系统参数:IP_MULTICAST_TIL调优参数:netty 核心参数:3.重要参数详解:SO-reuseaddr...原创 2020-08-27 20:45:59 · 557 阅读 · 0 评论 -
Netty 源码分析_ChannelHandlerContext和ChannelInitializer_(4)写数据
可以看到,Channel被包装为ChannelPromise,它持有Channel和EventLoop。在上节中介绍了ChannelPipeline,其中常用的方法是addLast(handler)将各类ChannelHandler实例添加到Channel的 ChannelPipeline中。下面我们来看addLast(handler)方法的实现:最后调用:callHandlerAdded0 方法:执行刚刚被添加的ChannelHander对象的handlerAdde...原创 2020-08-26 16:51:19 · 521 阅读 · 0 评论 -
Netty http 相关机制
keep-alive,gzip,truncked3 压缩 3.1 背景 在http请求(特别是移动端),如果请求的资源比较多,则网络的开销会比较大,用户体验较差。则可以开启数据的无损压缩,节省传输的流量,提升数据的加载性能。3.2 压缩类型 1:压缩需要客户端,服务器端同时支持。在chrome中,请求默认会加上Accept-Encoding:gzip, deflate,客户端默认开启数据压缩。而tomcat默认关闭压缩,如果开启需要增加配置。 2:在请求时,需...原创 2020-08-25 18:03:10 · 346 阅读 · 0 评论 -
netty http
Netty http server 设计原理:Netty http test 测试:---------------------------------------Netty http server 设计原理:1.1 描述:标示 ASCII 描述 字符 CR 13 Carriage return (回车) \n LF 10 Line feed character(换行) \r SP 32 Hori...原创 2020-08-25 17:42:38 · 191 阅读 · 0 评论 -
附:Netty 源码编译
1.1、安装Maven1.2、下载Netty源码1.3、编译Netty1.3.1、maven 编译1.4在编译中有个细节,由于我们只关心其核心源码,所以其他的测试模块可以省略。-------------------------------------------------------------------------------------------------------------1.1、安装Maven1.2、下载Netty源码去github 上获取1...原创 2020-08-25 16:52:11 · 598 阅读 · 0 评论 -
Channel和ChannelPipeline 创建_(4)接受处理数据
在启动配置中的方法channel(NioServerSocketChannel.class)会创建一个ReflectiveChannelFactory并赋值给成员变量channelFactory。当调用绑定端口号方法bind(8899)时2.NioServerSocketChannel的构造函数在构造函数中首先调用静态方法newSocket(),创建一个Java Nio ServerSocketChannel实例,它继承SelectableChannel。然后调用父类Abs...原创 2020-08-24 17:58:29 · 814 阅读 · 0 评论 -
Netty 源码分析(2)——创建连接
get 方法:Future<V> addListeners(GenericFutureListener<? extends Future<? super V>>... listeners);/** * Removes the first occurrence of the specified listener from this future. * The specified listener is no longer notified whe...原创 2020-08-21 18:19:05 · 299 阅读 · 0 评论 -
Netty 源码分析系列(1)_主服务启动
public class MyServer { public static void main(String[] args) throws InterruptedException { EventLoopGroup bossGroup = new NioEventLoopGroup(); EventLoopGroup workerGroup = new NioEventLoopGroup(); ServerBootstrap serverBoot.原创 2020-08-20 19:52:33 · 241 阅读 · 0 评论