Netty's easy to understand summary --45.server clients and how we should analyze source code

bossGroup only responsible for the connection, not anything else;

workGroup handles all connection event

serverBootstrap connection information for a large number of objects and parameters, enabling developers to easily call the service starts up quickly

 

channel objects: the way is the way to create a class object reflected by newInstance to create out.

 For bossGroup handler is used (for the processing inside LoggingHandler log processor);

childHandler is used for workerGroup

For custom processors, we can use the pipe pipeline processor netty provided.

LengthFieldFrameDecoder (): Problems and unpacking of connected packages tcp to handle, i.e. the problem of breaking the package.

 

 

 MyServerHandler () processor is a custom: when the associated event is triggered will be executed

 Finally, start the server via a port number binding.

How to analyze source code Summary: Until now we basically almost the entire netty server source code analysis of the.

Source analysis three considerations:

1. Be sure to follow step by step;

2. The use of a proper judgment of the debug mode;

3. We analyze the source code must be a source for analysis and source code analysis, you understand it is to create an object, and then call what object did what, and what type of return. But you do not have any value. So how can it worth?

In fact, we want to understand the main netty Why should we do, what it motivates you.

Ask several questions:

1. We can think about why netty use to complete two EventLoopGroup start the server, not a EventLoopGroup can be done?

Nio these objects in the channel 2. The package approach is how the package?

3. The entire server With this invocation, the theory is based on what?

 

 

Guess you like

Origin blog.csdn.net/qq_37909508/article/details/91346606