Example #1
0
  public OioDatagramChannel(Integer id, MulticastSocket socket) {
    super(null, id);

    boolean success = false;
    try {
      socket.setSoTimeout(SO_TIMEOUT);
      socket.setBroadcast(false);
      success = true;
    } catch (SocketException e) {
      throw new ChannelException("Failed to configure the datagram socket timeout.", e);
    } finally {
      if (!success) {
        socket.close();
      }
    }

    this.socket = socket;
    config = new DefaultDatagramChannelConfig(socket);
  }