Does HTTP use UDP?

前端 未结 14 1308
夕颜
夕颜 2020-11-29 18:12

This might be a silly question:

  • Does HTTP ever use the User Datagram Protocol?

For example:

If one is

相关标签:
14条回答
  • 2020-11-29 18:38

    If you are streaming an mp3 or video that may not necessarily be over HTTP, in fact I'd be suprised if it was. It would probably be another protocol over TCP but I see no reason why you cannot stream over UDP.

    If you do you have to take into account that there is no certainty that your data will arrive at the other end, but I can take it that you know about UDP.

    To answer you question, No, HTTP does NOT use UDP. For what you talk about though, mp3/video streaming COULD happen over UDP and in my opinion should never happen over HTTP.

    0 讨论(0)
  • 2020-11-29 18:41

    I think some of the answers are missing an important point. The choice between UDP and TCP should not be based on the type of data (e.g., audio or video) or whether the application starts to play it before the transfer is completed ("streaming"), but whether it is real time. Real time data is (by definition) delay-sensitive, so it is often best sent over RTP/UDP (Real Time Protocol over UDP).

    Delay is not an issue with stored data from a file, even if it's audio and/or video, so it is probably best sent over TCP so any packet losses can be corrected. The sender can read ahead and keep the network pipe full and the receiver can also use lots of playout buffering so it won't be interrupted by the occasional TCP retransmission or momentary network slowdown. The limiting case is where the entire recording is transferred before playback begins. This eliminates any risk of a playback stall, but is often impractical.

    The problem with TCP for real-time data isn't retransmissions so much as excessive buffering as TCP tries to use the pipe as efficiently as possible without regard to latency. UDP preserves application packet boundaries and has no internal storage, so it does not introduce any latency.

    0 讨论(0)
  • 2020-11-29 18:42

    Yes, HTTP, as an application protocol, can be transferred over UDP transport protocol. Here are some of the services that use UDP and an underlying protocol for transferring HTTP data and streaming it to the end-user:

    • XMPP's Jingle Raw UDP Transport Method
    • A number for services that use UDT --- UDP-based Data Transfer Protocol, which is the a superset of UDP protocol.
    • The Transport Layer Security (TLS) protocol encapsulating HTTP as well as the above mentioned XMPP and other application protocols does have an implementation that uses UDP in its transport layer; this implementation is called Datagram Transport Layer Security (DTLS).
    • Push notifications in GNUTella are HTTP requests sent over UDP transport.

    This article contains further details on streaming over UDP and its reliable superset, the RUDP: Reliable UDP (RUDP): The Next Big Streaming Protocol?

    0 讨论(0)
  • 2020-11-29 18:43

    Of course, it doesn't necessarily have to be transmitted over TCP. I implemented HTTP on top of UDP, for use in the Satellite TV Broadcasting industry.

    0 讨论(0)
  • 2020-11-29 18:46

    UDP is the best protocol for streaming, because it doesn't make demands for missing packages like TCP. And if it doesn't make demands, the flow is far more faster and without any buffering.

    Even the stream delay is lesser than TCP. That is because TCP (as a far more secure protocol) makes demands for missing packages, overwriting the existing ones.

    So TCP is a protocol too advanced to be used for streaming.

    0 讨论(0)
  • 2020-11-29 18:47

    Typically, no.

    Streaming is seldom used over HTTP itself, and HTTP is seldom run over UDP. See, however, RTP.

    For something as your example (in the comment), you're not showing a protocol for the resource. If that protocol were to be HTTP, then I wouldn't call the access "streaming"; even if it in some sense of the word is since it's sending a (possibly large) resource serially over a network. Typically, the resource will be saved to local disk before being played back, so the network transfer is not what's usually meant by "streaming".

    As commenters have pointed out, though, it's certainly possible to really stream over HTTP, and that's done by some.

    0 讨论(0)
提交回复
热议问题