BootStrap组件分析
作用是配置整个Netty程序,串联各个组件,Netty中BootStrap类是客户端的启动引导类,ServerBootStrap是服务端的启动引导类
常用方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| public ServerBootstrap group(EventLoopGroup parentGroup, EventLoopGroup childGroup)
public B group(EventLoopGroup group)
public B channel(Class<? extends C> channelClass)
public B handler(ChannelHandler handler)
public ServerBootstrap childHandler(ChannelHandler childHandler)
public <T> B option(ChannelOption<T> option, T value)
public <T> ServerBootstrap childOption(ChannelOption<T> childOption, T value)
public ChannelFuture bind(int inetPort)
public ChannelFuture connect(String inetHost, int inetPort)
|