Sometimes what happens on my phone is that after a certain period of
inactivity the device shuts down the internet connection.
I'm not familiar with ThreadSafeClientConnManager but I'm guessing it
doesn't fail when the connection was shut down and fails when you
attempt to read/write data.

This is just a guess though, but you shouldn't be getting exceptions
in your code like that.  If the network goes down and then back up,
you have to reconnect your sockets.


On Tue, Jan 18, 2011 at 2:39 AM, lou <[email protected]> wrote:
> Thanks for you answer Kostya !
> Unfortunately, add header "Connection : close" to every requests
> doesn't work, I've always some timeout...
> And it's a good idea to retry the request, but it's just hide the
> problem, not solve it...
> Another idea? :)
>
> Regards.
>
>
> On Jan 18, 10:17 am, Kostya Vasilyev <[email protected]> wrote:
>> I think this might be caused by http keep-alive, you can try disabling that.
>>
>> Another option is to hide the failure inside HttpClient from your code
>> by setting a retry count.
>>
>> -- Kostya
>>
>> 18.01.2011 12:07, lou пишет:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> > Just for info I've already tried this code :
>>
>> > /* * * * * * code * * * * * */
>> > HttpConnectionParams.setConnectionTimeout(mParams, TIMEOUT);
>> > HttpConnectionParams.setConnectionTimeout(mParams, TIMEOUT);
>> > HttpConnectionParams.setSoTimeout(mParams, SOCKET_TIMEOUT);
>>
>> > On Jan 18, 9:57 am, lou<[email protected]>  wrote:
>> >> Hi !
>> >> I'm developping an application using websocket ( socket on port 80 )
>> >> in a service&  activities which send some HTTP requests.
>> >> I'm using a ThreadSafeClientConnManager and declarate it like this :
>>
>> >> /* * * * * * code * * * * * */
>> >> mParams = new BasicHttpParams();
>> >> mSchemeRegistry = new SchemeRegistry();
>> >> mSchemeRegistry.register(new Scheme("http", new PlainSocketFactory(),
>> >> 80));
>> >> mSchemeRegistry.register(new Scheme("https",
>> >> SSLSocketFactory.getSocketFactory(), 443));
>>
>> >> mCm = new ThreadSafeClientConnManager(mParams, mSchemeRegistry);
>> >> mClient = new DefaultHttpClient(mCm, mParams);
>>
>> >> Everything's seems to do their job, but if I don't send an HTTP
>> >> request after a while, when I tried to send it again, requests got 1
>> >> or 2 SocketException timeout, and works again after this.
>> >> I hope there's a answer to this problem.
>> >> Thanks in advance.
>> >> Louis C.
>>
>> --
>> Kostya Vasilyev -- WiFi Manager + pretty widget 
>> --http://kmansoft.wordpress.com
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
~ Jeremiah:9:23-24
Android 2D MMORPG: http://developingthedream.blogspot.com/,
http://www.youtube.com/user/revoltingx

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

Reply via email to