I'm currently working with Java NIO and facing a challenge with Datagram channels. I need to set the "Don't Fragment" bit for UDP packets, but I've discovered that there’s no option available in Java NIO to do this.
Unlike other platforms that provide support for setting this bit directly (for example, using setsockopt in C++ for BSD Sockets), Java NIO’s DatagramChannel doesn’t expose any socket options that would allow for this configuration. I’ve looked through the available options, and it seems we’re limited in this regard. Can anyone guide me on how can I achieve this using Java NIO?
I looked into official docs and also tried to search the github repos for similar usecase but could not find anything.
NOTE: My intentions for using Don't Frag bit is to discard any packets which are greater than MTU and only send packets which are less than or equal to the MTU.