1

I know that transferring files over UDP is possible even though TCP is preferred.

My question is how does the server know how much the client can handle or vice versa, or any router in between.

TCP uses "window size", since UDP doesn't acknowledge packets that are recived, should a similar thing be implemented in the application layer to control the flow of data, or other techniques are used?

2 Answers 2

6

My question is how does the server know how much the client can handle or vice versa, or any router in between.

By UDP alone, it doesn't. UDP is "fire and forget" - just send one datagram after the other. If the sender's transmission rate exceeds the path's capacity, excess datagrams are dropped.

When using UDP as transport, the application is required to keep track of the flow (if necessary). How that exactly is done is up to the application layer and off-topic here.

In most cases where you need to transfer larger data sets, TCP is the easiest solution by far. Trying to reinvent it on top of UDP is not a good idea unless you are very familiar with the complexities of congestion control.

4
  • Can't we say that QUIC now addresses flow control over UDP? UDP is the closest thing you can get to IP abstraction in layer 4, apart from the ports demultplexing of course.
    – piepi
    Sep 21, 2023 at 18:32
  • QUIC adds another transport layer on top of UDP, tracking delivery and congestion much in the same way as TCP (yet more optimized). QUIC can be seen as an L4 protocol in its own right, just hijacking UDP for the sake of NAT traversal.
    – Zac67
    Sep 21, 2023 at 18:55
  • But QUIC is in userspace, not inside the kernel. Wouldn’t that make it application layer?
    – piepi
    Sep 21, 2023 at 23:17
  • @piepi From the implementation point of view it's application layer, but from the functionality POV it's transport layer. ;-)
    – Zac67
    Sep 22, 2023 at 6:00
1

"TCP uses "window size", since UDP doesn't acknowledge packets that are recieved, should a similar thing be implemented in the application layer to control the flow of data, or other techniques are used?"

You can do that at transport layer with UDP DCCP(Datagram Congestion Control Protocol). The RFC 6773 describes in detail how does the UDP can have a similiar congestion control as TCP. However, the standard UDP uses datagram without congestion controlling. In that case, there's no kind of reliability given at L4. Since you want to tunning and design mechanisms to avoid UDP characteristics, it must be done straight at application (Its not recommended) RFC 5405 RFC 768.

1
  • 1
    UDP doesn't know the path capacity. You can send datagrams as fast as your interface capacity allows.
    – Zac67
    Aug 3, 2020 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.