0

I am confused on whether UDP and TCP work together, or are they completely separate protocols.

So, UDP is used to allow multiplexing of different services on the same machine. So, essentially, for example, when I make a request to YouTube.com (from Chrome application, let's say running on port 10). First, my packet will be created with IP address (and different headers), and a TCP connection would be make to the YouTube server.

Then, when the server responds back, it will send the data to the source machine (that made the request) at the port (10). Is this when the UDP protocol is used? So, if I have another application like Netflix streaming on my computer (running on port 11), then UDP knows that there is a stream on port 10 and port 11 and it will multiplex this data coming in from the Internet to the specific ports of the application that is running on my machine?

I am having a hard time understanding whether UDP is used in every TCP/IP connection since every application essentially runs on the port on the computer. So, would the UDP protocol know of all of these applications running at whichever port on the specific machine and multiplex data at this port?

1 Answer 1

7

UDP and TCP are completely separate Transport Layer (Layer 4 in the OSI model) protocols. There are also other layer-4 protocols, but TCP and UDP are the most commonly used. UDP was first, and it is a connectionless, unreliable, fire-and-forget protocol. TCP was added later to provide connections and reliability to layer 4.

Layer-4 protocols have their own addresses, called ports. UDP port 10 is not the same thing as TCP port 10. Applications register with TCP or UDP to use their ports. Only one application can use a per-protocol port at any given time, but if you have two different applications, one could use UDP port 10 at the same time as another uses TCP port 10.

UDP is only used by applications which want to use UDP, and TCP is only used by applications which want to use TCP. Some applications will use both protocols, and some applications use neither. Neither protocol is required by IPv4 or IPv6.

3
  • So if I make a request to YouTube.com from Chrome it will use a TCP connection and to stream the video it would use UDP? Since you said some applications can use both. Nov 13, 2016 at 1:30
  • HTTP and HTTPS use TCP. A web browser will request a random port from TCP to use for the connection to the web server. In fact, many web browsers will open multiple TCP connections using different TCP ports to the same web server in order to simultaneously retrieve different web page elements. The video application could certainly use UDP, too.
    – Ron Maupin
    Nov 13, 2016 at 1:34
  • Actually, TCP came first in 1974, originating in the CYCLADES project. UDP was added in 1980. ;^)
    – Zac67
    Mar 2, 2018 at 7:30

Your Answer

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

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