Is UDP a Stateless or Stateful Protocol?
I used to conduct a lot of interviews and one of the questions I typically asked people interviewing for network admin positions is "what's the difference between TCP and UDP?" I was frankly shocked at some of the answers I received by these so-called network professionals. One of the more interesting answers I received was "UDP is a protocol for users and TCP is a protocol for transmissions". Hmm. Anyway, the short answer to the title of this article is "NO" - UDP is not stateful. I'll explain in simple terms why by defining exactly what "stateful" means, explaining UDP in simple terms, and explaining TCP in simple terms. Sounds pretty exciting, right?
Stateful = I expect something
Stateless = I expect nothing
What Is Stateful?
Stateful means the item you are describing is aware of its "state." For instance, I am a stateful person. If I say hello to you, I enter a "state" of expectation for an answer back. If I don't receive a response I may say hello again, thinking you may not have heard me the first time. If I'm ignored again, I may give up and go cry myself to sleep for being neglected! Eventually, I exit the "state" of wanting an acknowledgment for my hello and move on to something or someone else.
In terms of technology protocols, like TCP/IP, the same rules apply. A stateful protocol expects a response. A stateless protocol doesn't care. A stateless protocol is akin to a TV broadcast - the broadcast doesn't care if you watch it, if you like it, if you talk to it, etc. The TV broadcast has no expectations!
Spray and Pray
UDP is also known as "Spray and Pray" - spray the packets on the wire and pray they get to their destination!
UDP is StateLess
In case you haven't guessed, UDP (User Datagram Protocol) is Stateless. This means it has no expectations. Here are some of the characteristics of the expectationless UDP:
- I don't care if what I send is received
- I don't care if one of my packets was lost in transit
- I don't care if you acknowledge my existence
- I don't care if you like me or simply discard me
- Basically, I'm a slacker and don't care about anything
TCP - the Stateful Overachiever!
TCP (Transmission Control Protocol), in contrast to UDP, is stateful. TCP has expectations! Here are some of the characteristics of TCP:
- I expect you to acknowledge my message
- If you don't acknowledge my message, I may assume you didn't hear me and I will retransmit it again
- I expect us to interact nicely and acknowledge each other on a regular basis
- I'm quite obsessive and like to track our conversation. This way I can resend something if you miss it.
- I like to leave on good terms by politely ending our conversation
More by this Author
YESTERDAY BO THOMAS WAS FOUND DEAD IN HIS HOME IN CLARKSVILLE, ARKANSAS - Thomas, having read that celery takes more calories to digest than it contains, decided to go on a "celery diet." Celery diets have...
I find myself trying to eat all organic foods. I still eat meat though, but I try to only eat organic (grass-fed) meat. This is sort of a problem for me though because healthy, non-processed, organic food seems rare to...
On a trip to Belize, I was talked into taking anti-malaria pills. Chloroquine caused serious nightmares and dizziness, but I guess it's better than getting malaria.