Linux - Can I Duplicate, send, then and Deduplicate UDP packets?
Solution 1:
I know this is an older thread, but you might want to look into FEC.
Check our the "UDPspeeder" application written by wangyu. You can find it here on git: https://github.com/wangyu-/UDPspeeder
This application doesn't just duplicate the packet, but sends packets with information about being able to reconstruct the packet that is lost if needed.
There are lots of parameters to tune for your needs.
Solution 2:
If an application transmits UDP packets, it must be prepared that some (or even many) of these packets are dropped.
So either the application must deal with that (e.g. real-time audio or video data, where the missing information is just ignored and causes reduced quality, because you can't resend packages), or it must implement its own protocol to ensure retransmitting, or it must use another protocol that guarantuees eventual delivery.
Implementing an external "just send 2 copies" layer is not the solution. Yes, I know you don't want to hear that, but it's true.
So rewrite the application to use the proper protocol.
Alternatively, tunnel the packets over some other application that implements a proper protocol (tun/tap interface). If you insist on "just duplicate packets" to be a proper protocol (it's not difficult to write such an application, google for tun/tap example programs), try it, and see if it works (it won't).