CoralReactor FAQ

Below some frequently asked questions about CoralReactor.

  1. How do I change the underlying socket send and receive buffer size?
    You can set the underlying kernel socket send and receive buffer size from Java. By default, CoralReactor will try to set the size of these buffers to 12Mb. If it is unable to change the size, it will alert you with an error log. The size limit of these buffers is configured in the OS level, so you might have to tweak your OS configuration to allow bigger buffers. To pass your own size, you can do:

    config.add("readSocketBufferSize", 24 * 1024 * 1024);
    config.add("writeSocketBufferSize" 24 * 1024 * 1024);
    Client client = new MyClient(nio, "localhost", 44444, config);

    You can also overwrite the default value from 12Mb to whatever you want with with the JVM command-line option: -DreadSocketBufferSize and -DwriteSocketBufferSize. Just keep in mind that this will affect only the clients and servers that have not set their own size through the config.

  2. Does AbstractUdpClient support multicast?
    Yes. Just pass a multicast address and it will join and work automatically. You can also specify the nic name/address to join through the client config:

    config.add("nic", "p1p4");
    Client client = new MyMulticastClient(nio, "", 44444, config);

    By default, a multicast client will join/leave automatically. If you want to join/leave the multicast group yourself you can call the methods join() and leave() manually. To do that pass in the client config:

    config.add("joinAutomatically", false);
  3. Does AbstractUdpClient support broadcast?
    Yes. Just pass a broadcast address and the client will receive broadcast packets. To send packets to a broadcast address you must remember to set the SO_BROADCAST option on the client. To do that, simply set isBroadcastAddr to true int the client config:

    config.add("isBroadcastAddr", true);