1, netty Get started

Examples of the netty basic models are: server -> Initializer -> Handler.

In the server to start the thread, open ports, setting initializer, and some parameters start configuration.

In Initializer, it is mainly responsible for adding handler processing chain. Can be obtained channel object.

Responsible for the main processing logic in the handle. Method handle:

  • The main processing method after receiving a request channelRead0
  • channelActive channel activation
  • channelInactive   channel 失活
  • channelRegistered   channel注册
  • channelUnregistered channel unregister
  • handlerAdded processing class is added

handle, is mainly dealing with class, order activation method, rewritten himself, after the addition of the sentence output will know:

handler added
channel registered
channel active channelRead0 channel inactive channel unregistered



Guess you like

Origin www.cnblogs.com/amibandoufu/p/11441614.html
Recommended