Suppose I have a UDP socket and send a msg to the server. Now how to figure out if the msg has been received by the server?
Coded acknowledgment from server is a trivial option, is there any other way to find out? I guess no..
Suppose I have a UDP socket and send a msg to the server. Now how to figure out if the msg has been received by the server?
Coded acknowledgment from server is a trivial option, is there any other way to find out? I guess no..
You can never be sure that a message arrives, even with TCP not. That is a general limitation of communication networks (also applies to snail mail, for example). You can start with the Bizantine Generals Problem if you want to know more.
The thing you can do, is to increase the likelihood of detecting a message loss. Usually that is done be sending an acknowledgement to the sender. But that may get lost too, so for 100% reliability, you would need to send an acknowledgement for the acknowledgement. And then an acknowledgement for the acknowledgement's acknowledgement. And so on.
My advice: Use TCP, if reliability is your main concern. It has been around for some time, and probably won't have some of the flaws a custom solution would have. If you don't need the reliability of TCP, but need low latencies or something else UDP is good at, use UDP. In that case better make sure that it is not a problem if some packets get lost.