![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
netty
With__Sunshine
这个作者很懒,什么都没留下…
展开
-
netty学习01--nio与oio的比较
一、NIONIOServer.javapackage NIO;import java.io.IOException;import java.net.InetSocketAddress;import java.nio.ByteBuffer;import java.nio.channels.SelectionKey;import java.nio.channels.Selector;...转载 2019-03-20 17:41:28 · 303 阅读 · 0 评论 -
netty学习02--netty helloworld
一、netty clientpackage com.client;import org.jboss.netty.channel.ChannelHandlerContext;import org.jboss.netty.channel.ChannelStateEvent;import org.jboss.netty.channel.ExceptionEvent;import org.jb...转载 2019-03-20 17:49:39 · 124 阅读 · 0 评论 -
netty学习03--netty线程模型分析
一、package com.cnpackage com.cn;import java.io.IOException;import java.nio.channels.Selector;import java.util.Queue;import java.util.concurrent.ConcurrentLinkedQueue;import java.util.concurrent....转载 2019-03-20 18:05:40 · 117 阅读 · 0 评论 -
netty学习04--netty案例学习
一、Client端package com.client;import java.io.BufferedReader;import java.io.InputStreamReader;import io.netty.bootstrap.Bootstrap;import io.netty.channel.Channel;import io.netty.channel.ChannelFu...转载 2019-03-20 18:12:01 · 154 阅读 · 0 评论 -
netty学习06-01--netty3心跳
一、所需jar包netty-3.10.5.Final-sources.jarnetty-3.10.5.Final.jar二、实现package com.heart;import org.jboss.netty.channel.ChannelEvent;import org.jboss.netty.channel.ChannelFuture;import org.jboss.nett...转载 2019-03-20 18:18:24 · 202 阅读 · 0 评论 -
netty学习06-02--netty5心跳
一、所需jar包netty-all-5.0.0.Alpha2-sources.jarnetty-all-5.0.0.Alpha2.jar二、实现package com.heart;import io.netty.channel.ChannelFuture;import io.netty.channel.ChannelFutureListener;import io.netty.ch...转载 2019-03-20 18:21:53 · 256 阅读 · 0 评论 -
【面试题】Netty相关
1.BIO、NIO和AIO的区别?BIO:一个连接一个线程,客户端有连接请求时服务器端就需要启动一个线程进行处理。线程开销大。 伪异步IO:将请求连接放入线程池,一对多,但线程还是很宝贵的资源。 NIO:一个请求一个线程,但客户端发送的连接请求都会注册到多路复用器上,多路复用器轮询到连接有I/O请求时才启动一个线程进行处理。 AIO:一个有效请求一个线程,客户端的I/O请求都是由OS...转载 2019-09-04 15:13:04 · 129 阅读 · 0 评论