UDP doesn't guarantee delivery of a packet. It's advantages over TCP are speed and packet size. Tacking on some sort of mechanism to UDP to guarantee delivery defeats the advantages of using UDP. If you NEED to guarantee delivery
you SHOULD use TCP. It has a well-tested delivery mechanism and you don't have to reinvent the wheel with your own untested code. Unless this is an assignment for school, in which case, you should be doing your own work.