1

I know that UDP is an unreliable protocol where things can arrive out of order, fail to arrive completely, etc.

I'm also aware that when using UDP for something like traceroute, packets that arrive at routers with TTL=1 and packets that arrive at end hosts destined for non-open ports generate ICMP error messages which are transmitted back to the sender.

My question is - does the sender have any way of knowing if a standard packet was dropped? I know the protocol is unreliable, but is any kind of "ack" sent back by the receiver in the UDP protocol whatsoever to allow the sender to know about the dropped packet?

This is a straight up protocol question for basic UDP, I don't want to know about what I "can do". I've read through a few things now and while I'm basically 100% sure the answer is no, you can't tell, I read a couple things which made me uneasy about it.

1
  • Stack Overflow is for programming related questions, not about networking protocols. Also, please refrain from using sigs/thanks in your posts. Thanks.
    – Kev
    Aug 3, 2011 at 23:38

2 Answers 2

7

By definition, if a UDP packet is dropped, the receiver cannot sent a notice back to the sender because nothing was received. You can layer your own acknowledgement system on top of UDP. Even a simple "if no data has been received in X seconds, send a packet to the sender indicating such". You can embed your own sequence numbers into the UDP packets, so that dropped/lost packets can be detected, but then you'd probably want to be using TCP anyways, since sequence numbers and drop/lost packet handling all come 'free' with TCP.

Basically, UDP is fire-and-forget. Routers are free to drop the packets on a whim without any kind of notice to the sender or receiver. If they did have to generate such a drop notice packet, it'd just add to the congestion conditions that caused the UDP packet to be dropped in the first place. Routers WILL deliver a UDP packet if they can, but if things get busy, UDP will be get lower priority than other protocols.

3
  • Thanks for the answer - just to clarify though, I was asking if the reciever acknowledges packets it does receive so that an unacknowledged packet could be identified as dropped. So, just to double check one more time - fire and forget means that no communication goes from the receiver to the sender for any of these packets, right?
    – w00te
    Aug 3, 2011 at 20:23
  • depends on how you've set up your UDP link. If your receiver code sends acknowledgements and embeds sequence numbers, then you can detect dropped packets due to the missing number (e.g. 1,2,4 - hey, where's 3?). but that's entirely up to your code to layer such semantics into the transmitted data.
    – Marc B
    Aug 3, 2011 at 20:27
  • w00te: the answer to your question is 'no'. UDP protocol does not specify any sort of acknowledgement whatsoever. (Yes you can roll your own but your question above says you do not care about that). @Marc B: There are very good reason to choose UDP or TCP. UDP is 'connection less' and that has various implications e.g. the issue of TCP port exhaustion. That said, I do agree that typically TCP is a far better choice than rolling your own UPD protocol.
    – alphazero
    Aug 4, 2011 at 0:38
1

The simplest way to understand a UDP packet is to compare it to a bullet shot from a gun. It gets sent out and as far as the gun (sender) is concerned the job's done. While there are ways to create feedback, that is something that must be tacked on as it's not built in.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .