Netty Associated -- Channel
A nexus to a network socket or a component which is capable of I/O operations such as read, write, connect, and bind.
一个网络套接字或组件的枢纽, 用来进行 I/O 操作, 例如 read, write, connect, bind.
A channel provides a user:
一个Channel的提供给用户的东西有:
- the current state of the channel (e.g. is it open? is it connected?),
- channel目前的状态(例如 是否是打开的? 是否是连接的?)
- the configuration parameters of the channel (e.g. receive buffer size),
- channel的配置参数(例如接收缓存的大小)
- the I/O operations that the channel supports (e.g. read, write, connect, and bind), and
- channel支持的I/O操作(例如 read, write, connect, bind)
- the ChannelPipeline which handles all I/O events and requests associated with the channel.
- 一个ChannelPipeline, 这个pipeline用来处理所有的I/O时间和域channel相关的请求
All I/O operations are asynchronous.
所有I/O操作都是异步的
All I/O operations in Netty are asynchronous. It means any I/O calls will return immediately with no guarantee that the requested I/O operation has been completed at the end of the call. Instead, you will be returned with a ChannelFuture instance which will notify you when the requested I/O operation has succeeded, failed, or canceled.
在Netty中所有I/O操作都是异步的. 这意味着任何的IO调用都会立即返回, 但是无法保证在IO调用完成以后,请求的IO操作已经完成了.取而代之的是, 你会被返回一个ChannelFuture实例, 它在请求的IO操作成功, 失败, 取消的时候会通知你.
Channels are hierarchical
Channel是分等级的
A Channel can have a parent depending on how it was created. For instance, a SocketChannel, that was accepted by ServerSocketChannel, will return the ServerSocketChannel as its parent on parent().
一个Channel可以有一个父母, 这取决于他是如何被创建的. 例如, 一个被ServerSocketChannel接受的SocketChannel, 调用它的parent()方法会返回他的父母 -- ServerSocketChannel
The semantics of the hierarchical structure depends on the transport implementation where the Channel belongs to. For example, you could write a new Channel implementation that creates the sub-channels that share one socket connection, as BEEP and SSH do.
分级结构的语义取决于Channel从属的传输实现.例如,你可以写一个新的Channel实现, 它创建一个子channel, 并共享一个socket连接, 就像 BEEP和SSH那样.
Downcast to access transport-specific operations
向下转型来访问特定传输协议操作
Some transports exposes additional operations that is specific to the transport. Down-cast the Channel to sub-type to invoke such operations. For example, with the old I/O datagram transport, multicast join / leave operations are provided by DatagramChannel.
一些传输协议暴露了一些这个协议特有的操作.可以将Channel向下转型为一个子类型来调用这些操作. 例如, 旧的IO数据报传输协议, 组播 join/ leave 操作都是由 DatagramChannel提供的.
Netty Associated -- Channel的更多相关文章
- Netty 源码解析(二):Netty 的 Channel
本文首发于微信公众号[猿灯塔],转载引用请说明出处 接下来的时间灯塔君持续更新Netty系列一共九篇 Netty源码解析(一):开始 当前:Netty 源码解析(二): Netty 的 Channel ...
- Netty之Channel*
Netty之Channel* 本文内容主要参考**<<Netty In Action>> ** 和Netty的文档和源码,偏笔记向. 先简略了解一下ChannelPipelin ...
- spark2.1源码分析3:spark-rpc如何实现将netty的Channel隐藏在inbox中
class TransportServer bootstrap.childHandler(new ChannelInitializer<SocketChannel>() { @Overri ...
- spark-rpc是如何实现将netty的Channel隐藏在inbox中的
class TransportServer bootstrap.childHandler(new ChannelInitializer<SocketChannel>() { @Overri ...
- Netty:Channel 建立后消息发送失败
1. 问题现象 Channel 建立后消息发送失败: ChannelFuture future = DeviceManager.getBootstrap().connect(); deviceChan ...
- Netty的Channel
Channel是一个网络端口连接,或者是可以进行读,写,链接,绑定端口的组件的连接. Channel就是一个链接,它提供了如下的功能. 1:获取当前链接的状态 2:配置当前链接参数 3:进行read ...
- netty笔记-:Channel与ChannelHandlerContext执行write方法的区别
在netty中有我们一般有两种发送数据的方式,即使用ChannelHandlerContext或者Channel的write方法,这两种方法都能发送数据,那么其有什么区别呢.这儿引用netty文档 ...
- Netty:Channel
上一篇我们通过一个简单的Netty代码了解到了Netty中的核心组件,这一篇我们将围绕核心组件中的Channel来展开学习. Channel的简介 Channel代表着与网络套接字或者能够进行IO操作 ...
- 项目系统Netty的Channel和用户之间的关系绑定正确做法,以及Channel通道的安全性方案
前言 考虑一个功能业务,在web程序中向指定的某个用户进行实时通讯 在Web运用的Socket通讯功能中(如在线客服),为保证点对点通讯.而这个看似简单的根据用户寻到起channel通道实际会碰到不少 ...
随机推荐
- php版本CKFinder3.4.4自定义上传文件位置
1.修改文件上传路径: 编辑ckfinder目录下config.php,70行设置为: 'baseUrl' => '/uploads/'.date('Ymd').'/'; 这样上 ...
- android activity 启动模式
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha 1,标准的, 2,单个 顶部 3,单个 任务 4,单个 实例 标准的 就是 每启动一次这 ...
- 使用 IntraWeb (4) - 页面布局之 TIWRegion
TIWRegion 是容器, 首先布局好它(们). 在空白窗体上添加 4 个 TIWRegion, 然后: uses System.UITypes; //为使用 Anchors 属性 {下面代码中的设 ...
- [原创]浅谈H5页面性能测试
[原创]浅谈H5页面性能测试 H5页面我想各位都不陌生,随着移动互联网兴起,不管是App,还是H5都火起来了,最突出的2个表现是ios/android/前端等工程师薪水大涨,尤其是资深前端工程师40W ...
- Supported Values for @SuppressWarnings(转)
Update July 2011: This list has been reviewed and made current with the most recent Eclipse 3.7 rele ...
- [多问几个为什么]为什么匿名内部类中引用的局部变量和参数需要final而成员字段不用?(转)
昨天有一个比较爱思考的同事和我提起一个问题:为什么匿名内部类使用的局部变量和参数需要final修饰,而外部类的成员变量则不用?对这个问题我一直作为默认的语法了,木有仔细想过为什么(在分析完后有点印象在 ...
- 【防火墙技术连载11】强叔侃墙 攻击防范篇 流量型攻击之UDP Flood及防御
http://support.huawei.com/huaweiconnect/enterprise/thread-214141.html
- hdu 1042 N! 高精度运算
N! Time Limit: 10000/50 ...
- ASP.NET Web API中展示实体Link相关的方面
有时候,向服务端请求一个实体,我们希望返回如下的格式: links: [ href: http://localhost:8901/api/user/diaries/2013-08-17, ...
- C#编程(三十一)----------泛型总结
C#泛型总结 C#中的所谓的泛型程序设计和C++中相应的模版类似. 泛型方法 C#中的泛型方法是指使用了类型参数的方法成员,案例: static void Main(string[] args) { ...