[android-developers] HttpURLConnection + keep alive timeout? (the way forward starting with gingerbread)

2012-01-05 Thread Mark Wyszomierski
Hi,

It looks like the android team will be investing more resources in
support / improvement of the HttpURLConnection class, based on this
dev post here:

http://android-developers.blogspot.com/2011/09/androids-http-clients.html
For Gingerbread and better, HttpURLConnection is the best choice
New applications should use HttpURLConnection; it is where we will be
spending our energy going forward.

It looks like connection pooling is supported by HttpURLConnection,
but seems to have a timeout of 5 seconds? (I can't find any
documentation on this). Is there any way to increase the duration that
connections are kept alive?

I'm creating connections to https://example.com/echo?param=abc;. If
the user initiates connections in intervals  5 seconds, I can see the
https setup is avoided, hinting me that the connection is being
reused.

But if the connections are spaced out  5 seconds, I see the entire
https setup done again, making me think the connections are not being
reused.

Is there a way for us to increase this timeout?

Thank you

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] HttpURLConnection + keep alive timeout? (the way forward starting with gingerbread)

2012-01-05 Thread Kristopher Micinski
On Thu, Jan 5, 2012 at 11:26 AM, Mark Wyszomierski mar...@gmail.com wrote:
 Hi,

 It looks like the android team will be investing more resources in
 support / improvement of the HttpURLConnection class, based on this
 dev post here:

 http://android-developers.blogspot.com/2011/09/androids-http-clients.html
 For Gingerbread and better, HttpURLConnection is the best choice
 New applications should use HttpURLConnection; it is where we will be
 spending our energy going forward.

 It looks like connection pooling is supported by HttpURLConnection,
 but seems to have a timeout of 5 seconds? (I can't find any
 documentation on this). Is there any way to increase the duration that
 connections are kept alive?

 I'm creating connections to https://example.com/echo?param=abc;. If
 the user initiates connections in intervals  5 seconds, I can see the
 https setup is avoided, hinting me that the connection is being
 reused.

 But if the connections are spaced out  5 seconds, I see the entire
 https setup done again, making me think the connections are not being
 reused.

 Is there a way for us to increase this timeout?

 Thank you


Sorry if I didn't answer your original question but just post a
comment: it seems that this eventually just calls down to apache
harmony, which has been abandoned recently: I wonder how this will
influence further development...

Kris

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] HttpURLConnection + keep alive timeout? (the way forward starting with gingerbread)

2012-01-05 Thread Nikolay Elenkov
On Fri, Jan 6, 2012 at 3:31 AM, Kristopher Micinski
krismicin...@gmail.com wrote:
 On Thu, Jan 5, 2012 at 11:26 AM, Mark Wyszomierski mar...@gmail.com wrote:

 Is there a way for us to increase this timeout?

 Thank you


 Sorry if I didn't answer your original question but just post a
 comment: it seems that this eventually just calls down to apache
 harmony, which has been abandoned recently: I wonder how this will
 influence further development...

Assuming Harmony was modelled after the JDK, there is some info
about keep-alive here:

http://docs.oracle.com/javase/1.5.0/docs/guide/net/http-keepalive.html

Also make sure your server is not closing the connections.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en