1

I was just wondering if anyone can tell me why all UDP diagrams I have seen list a request from the server to the client as the first point of communication? Take a look at the following diagram for example: https://www.educba.com/tcp-vs-udp/

TCP vs UDP

I was under the assumption that a client would have to always be expecting a request. Is there a missing step in all such diagrams such as it not first including a datagram being sent from the client to the server? If so, what is the rationale of not including this in diagrams?

1
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can post and accept your own answer.
    – Ron Maupin
    Commented Dec 17, 2020 at 20:51

2 Answers 2

2

For TCP and UDP, there are no clients or servers. The client/server concept is an application concept that is off-topic here.

TCP creates connections between peers, while UDP is a fire-and-forget protocol. UDP will send a datagram with no expectation that the other side even receives the datagram, and it is up to the application or application-layer protocol to provide services that TCP may offer.


There are some problems with the link you provided. For example:

enter image description here

That is completely incorrect. The UDP header is eight octets, while the TCP header is 20 to 60 octets; just the opposite of what is shown. I would not trust the site.

6
  • Ron Maupin, not sure if French or just trolling. Octet and Byte are the same thing, man. What are you on about? I'm surprised you managed to get all those rep points, and badges. 🤣 Commented Aug 22, 2020 at 19:34
  • Did you not notice that the TCP and UDP header lengths are just the opposite of what the diagram shows?
    – Ron Maupin
    Commented Aug 22, 2020 at 19:37
  • 1
    I wish I could comment, man, but with all the strictly stupid rules all StackOverflow websites have, it's hard for people to do the most natural of things. I wanted to comment, but I couldn't, and you were right about the UDP/TCP header size thingy; I just got confused when you used octet instead of byte, which gave me the impression that you were trolling. Ron's right, Johnny. That website can't be trusted. Hehe Commented Aug 22, 2020 at 19:40
  • 1
    Octet comes out in network discussions sometimes because many protocols we still use today were designed in an era when not all the mainstream computers had 8 bits per byte. Octet means a "byte" made of exactly eight bits. Commented Aug 22, 2020 at 22:37
  • 1
    @AhmedAnssaien "Bytes" used to be a system's smallest addressable data chunk, with "byte" varying from 6 to 9 bits (mostly). That's why 1970s networking standards used the more precise "octet" with is 8 bits always - long before the meaning of "byte" for exactly 8 bits settled in common computing. "Octet" is still widely used in networking when it's important to indicate 8 bits exactly.
    – Zac67
    Commented Aug 23, 2020 at 12:53
2

The first diagram is misleading: TCP uses a triple handshake to establish a socket connection. There is no equivalent to that for UDP since UDP is connectionless and datagrams are simply sent away.

Request/response is a very common scheme on the application layer (which is off-topic here) but that has no relation to whether the transport layer establishes a socket connection or just sends independent datagrams. DNS can send requests/responses over both UDP or TCP (with the former being far more common for normal clients). HTTP request are normally sent over TCP but UDP is also possible.

There are many other inaccuracies, ambiguities and even outright errors on that page, so you might want to read somewhere else.

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.