上文我们从netty-example的Discard服务器端示例分析了netty的组件,今天我们从另一个简单的示例Echo客户端分析一下上个示例中没有出现的netty组件. 1. 服务端的连接处理,读写处理 echo客户端代码: /** * Sends one message when a connection is open and echoes back any received * data to the server. Simply put, the echo client initia…
分析netty从源码开始 准备工作: 1.下载源代码:https://github.com/netty/netty.git 我下载的版本为4.1 2. eclipse导入maven工程. netty提供了一个netty-example工程, 分类如下: Fundamental Echo ‐ the very basic client and server Discard ‐ see how to send an infinite data stream asynchronously withou…