As a starting point, you need to read http://en.wikipedia.org/wiki/Two_Generals%27_Problem.
This is an instance of a very famous, and very common, problem in computer-science. Technically it is considered 'solved' as we know the answer; however, the short-story is: what you are asking for is (strictly speaking) impossible. There are protocols you can devise that will allow you to achieve any level of confidence the message has (or has not) been delivered, provided that confidence is <1.0.
In practice variations on two and three-phase distributed transaction protocols are used, along with various retransmit and resynchronisation fallbacks. The specifics depend on the implementation.
Often the choice is to permit the possibility of duplicates and require the Receiver to respond appropriately. This is the choice made by TCP, which if you think about it is trying to find a reasonable answer to the same question.