Skip to Main Content

Developer Community

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

No Support for "Don't Fragment" Bit in Datagram Channels in Java NIO

Harshal GoyalOct 15 2024 — edited Oct 16 2024

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 use case 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.

Comments
Post Details
Added on Oct 15 2024
0 comments
80 views