Whats the difference between stateless and connection-less?

Viewed 6381

Whats the difference between stateless and connection-less ? Also, what are the uses of these and the uses of their opposites (stafeful and connection-ful) ?

1 Answers

For "connection-less", the more accurate term should be "Not Connection-Oriented".

In any communication, there are 3 stages: start, interaction, end. The concept "Connection" focus on "start" and "end", while the concept "State" focus on "interaction".

If one communication protocol is "Connection-Oriented", it means real data can only be transferred after connection is established, and no data can be transferred after the connection is destroyed -- In telephone communication, we can talk to other people only if they pickup the phone, and can do nothing if they hangup.

If one communication protocol is "Not Connection-Oriented", it means real data can be sent whenever you want to. There is no "start" or "end" stage, only "interaction" -- In telegraph communication, we can send message directly.

If one communication protocol is "Stateful", it means in "interaction" stage, at least one communication side (client/server) will remember the state of opposite side -- In TCP communication, sequence number is stored and managed is both sides.

If one communication protocol is "Stateless", it means in "interaction" stage, no state information is stored in either side. All message is sent in independent way -- In HTTP communication, server doesn't remember the state of client, all HTTP requests are sent independently.

Thus, these are 2 totally different concept. We can have:

  • "Connection-Oriented Stateful" protocol: TCP
  • "Not Connection-Oriented Stateless" protocol: UDP, HTTP
  • "Connection-Oriened Stateless" protocol: In telephone call, after opposite pickup, send multiple independent messages.
  • "Not Connection-Oriented Stateful" protocol: In telegraph communication, send multiple highly related and dependent messages.

Here are some "stateless connection" protocol in computer science world:

Related