File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes HTTP protocol: Connection-less or Connection-based? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "HTTP protocol: Connection-less or Connection-based?" Watch "HTTP protocol: Connection-less or Connection-based?" New topic

HTTP protocol: Connection-less or Connection-based?

Li Wei

Joined: Jan 22, 2002
Posts: 1
I'm now preparing SCEA exam part-1.
After I did serveral mock tests, I'm confused with the question "Is HTTP protocol connection-less or connection-based?".
Some mock tests say it is connection-less, while the other say it is connection-based.
Anybody has some idea on this question?
Ragu Sivaraman
Ranch Hand

Joined: Jul 20, 2001
Posts: 464
They are stateless protocol
I believe in HTTP 1.1 have the persistent option
Nicky Moelholm
Ranch Hand

Joined: Jan 20, 2002
Posts: 43
Hi, Raqu is right. What might confuse you is that HTTPS is stateful whereas HTTP is not.

Nicky Moelholm
MyCerts: SCJP 1.2, SCJP 1.5, SCJD, SCWCD 1.3, SCBCD 1.3, SCDJWS 1.4, SCEA, IBM 253
MyBooks: IBM WebSphere Application Server V7.0 Web Services Guide
Phil M

Joined: Jul 15, 2002
Posts: 5
HTTP 1.0 uses 'Tear Down'.. the client opens and closes a socket connection for each request so is connectionless.
HTTP 1.1 uses 'keep alive'.. the client holds the socket open over multiple requests. However, this is still regarded as connectionless as it is acceptable for the client or server to drop the connection at any time and the connection will be re-established again later.
Sanjay Raghavan
Ranch Hand

Joined: May 14, 2002
Posts: 148
I believe that HTTP is a connection-based but stateless protocol. It is connection based because it rides on top of TCP/IP which is a connection based protocol.
Now as others have pointed out the connection is made and then closed after each request in HTTP1.0 (that still doesn't make it connection less) In HTTP1.1, there is the concept of a durable connection (using the same connection across multiple HTTP requests.)
Since the server does not inherently care if two requests came from the same client, it is a stateless protocol. We can add state by using many techniques, some of which include HTTPS (secure and stateful), or by using the HTTP Session Object and rewriting the session key with every URL / cookies e.t.c.

Sanjay Raghavan<br />SCJP2, SCEA-J2EE<br />Moderator - <a href="" target="_blank" rel="nofollow">SCEA PREP</a><br />Co-Author - <a href="" target="_blank" rel="nofollow">SCEA@Whiz</a><br /><i>Where did you sip your Java Today?</i>
Mon Mayor
Ranch Hand

Joined: Mar 07, 2002
Posts: 40
I agree with all that is said here. However there are couple of possibilities by mixing and matching connection and connectionless layers.
I think there are lot of articles and guidelines in selecting the match according to application criteria. So coming from that angle http is a connecionless layer built on top of a connection oriented layer with the notion of servicing many clients. Similary there could be connection oriented layer somehow maintaining connection information over connectionless layer.
So categorizing a session level layer as connection or connectionless just based on the transport layer may not be right.
I think I have added some more confusion and the question that is http connection oriented or connectionless still remains ambiguous.
I agree. Here's the link:
subject: HTTP protocol: Connection-less or Connection-based?
It's not a secret anymore!