Class UdpBootstrap<R>

java.lang.Object
org.aoju.bus.socket.UdpBootstrap<R>
Type Parameters:
R - 请求信息

public class UdpBootstrap<R> extends Object
UDP服务启动类
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

  • Method Details

    • open

      public UdpChannel<R> open() throws IOException
      开启一个UDP通道,端口号随机
      Returns:
      UDP通道
      Throws:
      IOException - 异常
    • open

      public UdpChannel<R> open(int port) throws IOException
      开启一个UDP通道
      Parameters:
      port - 指定绑定端口号,为0则随机指定
      Returns:
      the object
      Throws:
      IOException - 异常
    • open

      public UdpChannel<R> open(String host, int port) throws IOException
      开启一个UDP通道
      Parameters:
      host - 绑定本机地址
      port - 指定绑定端口号,为0则随机指定
      Returns:
      the object
      Throws:
      IOException - 异常
    • shutdown

      public void shutdown()
    • setReadBufferSize

      public final UdpBootstrap<R> setReadBufferSize(int size)
      设置读缓存区大小
      Parameters:
      size - 单位:byte
      Returns:
      the object
    • setThreadNum

      public final UdpBootstrap<R> setThreadNum(int num)
      设置线程大小
      Parameters:
      num - 大小
      Returns:
      the object