Can I use Same TCP connection(for HTTP) to get the response fromserver

M

Matrixinline

Hi,

I am writing a browser application.

I just wnat to know is their any way to use the same HttpURLConnection
to be re use to fetch the data from another URL.

I know it is a silly question as Http is a Stateless application but I
am querious to know more about Keep - Alive persitance connection at
server end. as we know that Server can keep connection open if keep
alive is mentioned in the header.

Thanks
Anup
 
L

Lothar Kimmeringer

Matrixinline said:
I just wnat to know is their any way to use the same HttpURLConnection
to be re use to fetch the data from another URL.

No but HttpUrlConnection is using the same connection if
"keep-alive" is supported. But to you, this kind of
functionality is hidden and happens "automagically".


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 
B

bencoe

No but HttpUrlConnection is using the same connection if
"keep-alive" is supported. But to you, this kind of
functionality is hidden and happens "automagically".

Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!

Are you hoping to get stuff rendering eventually for this web-browser
you're working on, you might try playing with an existing library:

may I suggest this...

http://html.xamjwg.org/cobra.jsp

It supports style sheets and other neat things, it also has a few
memory leaks I found when I was working with the library, I should
probably tell them about these ;)

But if you're really interested in how HTTP connections and parsing
HTML documents can be done, I recommend this as a starting point... It
uses a DOM (document object model), which you will certainly want to
learn - It' used by parsing libraries like Xerces.
 
L

Lothar Kimmeringer

Are you hoping to get stuff rendering eventually for this web-browser
you're working on, you might try playing with an existing library:

I'm not trying to render anything. I even haven't asked a
question in this thread.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 
L

Lew

Lothar said:
I'm not trying to render anything. I even haven't asked a
question in this thread.

I don't know, this is just a WAG, but perhaps bencoe's comment was intended
for the OP with respect to the primary topic of the thread, which of course,
you did not initiate and thus probably were not the antecedent.
 
B

bencoe

I don't know, this is just a WAG, but perhaps bencoe's comment was intended
for the OP with respect to the primary topic of the thread, which of course,
you did not initiate and thus probably were not the antecedent.

Sorry Lothar, that was meant as a reply to the original message, as
Lew suggests.

Ben.
 
M

Matrixinline

Sorry Lothar, that was meant as a reply to the original message, as
Lew suggests.

Ben.

One more Please

When I say HttpURLConnection.close() does it close the TCP Connection
even if Keep Alive is true?
 
L

Lothar Kimmeringer

Matrixinline said:
When I say HttpURLConnection.close() does it close the TCP Connection
even if Keep Alive is true?

There is no close()-method but if you mean disconnect(), just
read the Javadoc:

http://java.sun.com/j2se/1.4.2/docs/api/java/net/HttpURLConnection.html#disconnect()

| Indicates that other requests to the server are unlikely in the
| near future. Calling disconnect() should not imply that this
| HttpURLConnection instance can be reused for other requests.

So it's a definitely "maybe, it depends on the concrete
implementation and should only be seen as suggestion to it
when used".


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top