public class UdpBootstrap extends Object
| 构造器和说明 |
|---|
UdpBootstrap(Protocol<Request> protocol,
MessageProcessor<Request> messageProcessor) |
UdpBootstrap(Protocol<Request> protocol,
MessageProcessor<Request> messageProcessor,
Worker worker) |
| 限定符和类型 | 方法和说明 |
|---|---|
UdpChannel |
open()
开启一个UDP通道,端口号随机
|
UdpChannel |
open(int port)
开启一个UDP通道
|
UdpChannel |
open(String host,
int port)
开启一个UDP通道
|
UdpBootstrap |
setBannerEnabled(boolean bannerEnabled)
是否启用控制台Banner打印
|
UdpBootstrap |
setBufferFactory(BufferFactory bufferFactory)
设置内存池的构造工厂。
|
UdpBootstrap |
setBufferPagePool(BufferPagePool bufferPool)
设置内存池。
|
UdpBootstrap |
setReadBufferSize(int size)
设置读缓存区大小
|
UdpBootstrap |
setThreadNum(int num)
设置线程大小
|
void |
shutdown() |
public UdpBootstrap(Protocol<Request> protocol, MessageProcessor<Request> messageProcessor, Worker worker)
public UdpBootstrap(Protocol<Request> protocol, MessageProcessor<Request> messageProcessor)
public UdpChannel open() throws IOException
IOExceptionpublic UdpChannel open(int port) throws IOException
port - 指定绑定端口号,为0则随机指定IOExceptionpublic UdpChannel open(String host, int port) throws IOException
host - 绑定本机地址port - 指定绑定端口号,为0则随机指定IOExceptionpublic void shutdown()
public final UdpBootstrap setReadBufferSize(int size)
size - 单位:bytepublic final UdpBootstrap setThreadNum(int num)
num - 线程数public final UdpBootstrap setBannerEnabled(boolean bannerEnabled)
bannerEnabled - true:启用,false:禁用public final UdpBootstrap setBufferPagePool(BufferPagePool bufferPool)
bufferPool - 内存池对象public final UdpBootstrap setBufferFactory(BufferFactory bufferFactory)
bufferFactory - 内存池工厂Copyright © 2024. All rights reserved.