Markus A.
Markus A.

Reputation: 12742

Don't Fragment flag in Java

Is it possible in Java to send a UDP packet with the "Don't Fragment" flag set using the standard API?

I don't see any relevant options on DatagramSocket or DatagramChannel.setOption (or better: StandardSocketOptions).

Upvotes: 0

Views: 1519

Answers (1)

Jim Garrison
Jim Garrison

Reputation: 86774

The "Don't Fragment" flag is part of IP, not TCP or UDP. IP is the protocol 1 layer below TCP and UDP (TCP and UDP packets are wrapped in IP).

You would need the ability to create a raw socket, which is not available in standard Java. There seems to be a library called "RockSaw" which might be of use. Be aware that your program will need to have root/administrator permissions to access raw sockets.

Upvotes: 1

Related Questions