Git Product home page Git Product logo

netty-study's Introduction

杂说

Netty Server和Client必须配合使用吗?
  • 这个倒是不用,如果只是客户端和服务器交互,那么服务器端只需要使用netty的server就可以了,有时候我们需要服务器与服务器通信,这个时候发起请求的一端可以使用netty的client,比较方便;
Netty Server如何独立于Client使用?
  • 两者之间通过HTTP协议进行通讯;红色框中都是Netty框架自带的,灰色框中的三个类是自己实现的; Client-Server交互图
ChannelHandler
Handler的执行顺序
  • Netty中的handler与Servlet中的filter很像,通过handler可以完成通讯报文的编码解码,拦截制定的报文,统一对日志错误进行处理,统一对请求进行计数,控制handler执行与否。
  • Netty中的所有handler都实现自ChannelHandler接口。按照输入输出来分,ChannelInboundHandler ChannelOutboundHandler两大类。ChannelInboundHandler对从客户端发往服务器的报文进行处理,一般用来执行解码,读取客户端数据,进行业务处理等;ChannelOutboundHandler对从服务器发往客户端的报文进行处理,一般用来编码,发送报文到客户端。
  • Netty中,可以注册多个handler。ChannelInboundHanderl按照注册的先后顺序执行;ChannelOutboundHandler按照注册的先后顺序逆序执行。 Client-Server交互图
关于Netty的好文章博客推荐

netty-study's People

Watchers

James Cloos avatar Sucre avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.