TCP is a STATEful protocol and HTTP is a STATEless protocol, why?
One question i was asked in MCA Class today by a smart guy is
Sir, I have a doubt, HTTP is based on TCP protocol and as we know TCP is a stateful protocol then why HTTP is stateless?
I answered him in HINDI in class room, but just sharing this to you here.
HTTP doesn't 'inherit' from TCP, but rather uses it for a transport. HTTP uses TCP for a stateful connection, but then disconnects. Later it will connect again, if needed. So, while you browse through a web site you create many different connections. Each one of those connections is stateful, but the conversation as a whole is not, since you are dropping the connection with every conversation.
Here is an analogy for you. Consider the phone service to be TCP and consider your relationship with distant family members to be HTTP. You will contact them with the phone service. Each call to them would be a stateful TCP connection. However, you don't constantly stay on the phone with them, as you will disconnect and call them back again at a later time. You would certainly expect them to remember what you talked about on the last call. HTTP in itself does not do that, but it is rather a function of the web server that maintains the state of the overall converstation.
The reason for this is pretty simple. Say you have a popular web server that takes millions of hits per day. Each one of those hits consists of a quick connect/disconnect. If each person using your web site maintained an open connection the whole time that they were there, it could potentially overwhelm your server. Also, there would often be conversations left open when the user has stopped looking at your web page.
All that said, I would agree that this is a bit of a misnomer. HTTP as a protocol could be considered stateful since it is using TCP (and a firewall will recognize each connection as such). However, the application (browser/web server) that is using HTTP is really not stateful.
Hope this helps you to understand the differences.