The request I make is from "GET" type, so I've no output and I think that it's not possible to send more data than expected. Correct me if I'm wrong. The request I make is exactly the same on Android and Windows Mobile and with WM, the server react correctly. The request seems to be good. Anyway, how can I access to socket object with an httpUrlConnection ?
I'm already listening to events: (ConnectivityManager.CONNECTIVITY_ACTION) and TelephonyManager (PhoneStateListener.LISTEN_DATA_CONNECTION_STATE). Nothing is coming up during the problem. On 28 sep, 16:39, Kostya Vasilyev <kmans...@gmail.com> wrote: > Kinda reading between the lines in the first link you posted, I had a > thought... Is your client sending more data in the HTTP request than the > server expects? > > There are two more things I would try: > > - Shut down the output side of your connection on the Android side after > you've sent the http(s) request - i.e. call socket.shutdownOutput() > > - Listen for connectivity changes and close the socket (this will come > from the UI thread) so the networking thread wakes up in its read. > > Here is a working example of listening for connectivity changes, in the > answer section: > > http://stackoverflow.com/questions/2294971/intent-action-for-network-... > > -- Kostya > > 28.09.2010 16:52, Cydrike пишет: > > > > > > > Looks like a SSL problem after all ? > > > Well, I've done more dumps. It appears that even when the connection > > is working, I can see this strange behavior of [RST]. The difference > > is that just after the [RST], a new [SYNC] is done and the connection > > "works" again. > > After going out of sleep mode there's just no new [SYNC]. > > > I've also made some tests with my Windows Mobile application which is > > using the same server in same conditions. There are no trace of those > > [RST] TCP flags. > > > Some researches with Google point me this article > >http://www.cpug.org/forums/secureclient-securemote/13951-tlsv1-alert-... > > andhttp://fixunix.com/tcp-ip/488997-ssl-tcp-connection-termination-resul.... > > > It's typically what we can see in the previously posted dump. > > > I'm not doing anything special to keep the session alive. I've got an > > infinite loop that read on the response InputStream. Since the server > > is supposed to respond me in chunked mode, I'm waiting for any new > > data in the InputStream. I can't use http. The server is not handling > > it. I'm not using any kind of "rooted" or modified firmware. I've got > > an HTC Desire with Android 2.1update1. > > I was also able to do some tests on an HTC Desire with Android 2.2. I > > know that SSL implementation has changed but the problem remains. > > > On 27 sep, 19:12, Kostya Vasilyev<kmans...@gmail.com> wrote: > >> Looking at the Wireshark dump, it looks like the server begins to > >> close the connection before the phone falls asleep: > > >> It's the FIN/ACK packet #212994 - highlighted in grey. > > >> The phone is supposed to send ACK (which it does) and then its own > >> FIN/ACK, confirming the close (which it does not). > > >> Instead we see some kind of "TLSv1 Encrypted Alert" - can't say anything > >> about that one. > > >> Then we get to the red lines: the phone aborts the connection by sending > >> RST/ACK, and the server replies with RST. > > >> So it looks like the server begins to close the connection much earlier > >> than previously thought, perhaps after sending data as usual, without > >> expecting that the connection will be kept around for other uses. > > >> Are you doing anything to artificially keep the session alive? What > >> happens if you use unencrypted http? Finally, are you using any kind of > >> "rooted" or modified firmware? > > >> -- Kostya > > >> 27.09.2010 19:27, Cydrike пишет: > > >>> I've looked at what's happening on the server. The server is as > >>> mobile, it doesn't see any closed connection. > >>> Here's what I've got from Wireshark: > >>> The connection is started at the beginning [sync]. Then I put the > >>> mobile in sleep mode. > >>> It's awaken when we can see the Encrypted Alert. > >>> Then a RST comes from the mobile ???? > >>> Nothing is going through the connection anymore. > >>> Can you explain me what's happening ? > >>> On 24 sep, 11:49, Cydrike<cedric.bruck...@gmail.com> wrote: > >>>> There's nothing in logcat apart from garbage collector actions. > >>>> I'm already listening to ConnectivityManager > >>>> (ConnectivityManager.CONNECTIVITY_ACTION) and TelephonyManager > >>>> (PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) events to track > >>>> network modifications. Nothing is caught when the problem occurs. > >>>> I'm going to check on server side if the connection is still alive or > >>>> not. I'll give you the information as soon as possible. > >>>> On 23 sep, 22:58, Kostya Vasilyev<kmans...@gmail.com> wrote: > >>>>> Oh, and check the logcat - I think you should see connection manager > >>>>> events > >>>>> at the time your connection goes bad. > >>>>> -- > >>>>> Kostya Vasilyev --http://kmansoft.wordpress.com > >>>>> 23.09.2010 14:00 пользователь "Cydrike"<cedric.bruck...@gmail.com> > >>>>> написал: > >>>>> Hello Kostya, > >>>>> I've tried what you said but my problem remains. I'm fact the problem > >>>>> only occurs when the device goes in sleep mode. If I let it connected > >>>>> to my PC (the screen never goes totally black), every thing is working > >>>>> fine. I've got a wakeLock in my application: > >>>>> final PowerManager pm = (PowerManager) > >>>>> getSystemService(Context.POWER_SERVICE); > >>>>> m_partialWakeLock = pm.newWakeLock((PowerManager.PARTIAL_WAKE_LOCK | > >>>>> PowerManager.ACQUIRE_CAUSES_WAKEUP), APPLICATION_NAME); > >>>>> I've implemented something that connect to my server each 3min when in > >>>>> sleep mode. It's not using the connection which is supposed to be > >>>>> alive because I can't send data on it. The server is as is and I can't > >>>>> change anything on it. This mechanism works, I manage to successfully > >>>>> connect to my server. But still after 5min my opened connection > >>>>> doesn't receive data anymore. > >>>>> Something in the sleep mode is putting my connection in "hold", I > >>>>> don't know. I'm not even sure that the connection is closed. It seems > >>>>> it's just stuck somewhere. > >>>>> The server is closing correclty any connection since when not in sleep > >>>>> mode I always detect it. So my first message has wrong information. > >>>>> Cédric > >>>>> On 22 sep, 12:26, Kostya Vasilyev<kmans...@gmail.com> wrote:> > >>>>> Like I said before, detecting a ... > >>>>>>>>> Kostya Vasilyev -- WiFi Manager + pretty widget -- > >>>>>http://kmansoft.wordpress.com-Masquerletextedesmessagesprécédents - > >>>>>>>>> - Afficher le texte des messages précédents -- Masquer le texte des > >>>>> messages précédents -> >>... > >>>>>> Kostya Vasilyev -- WiFi Manager + pretty widget -- > >>>>>http://kmansoft.wordpress.com-Masquerletextedes messages précédents - > >>>>>> - Afficher le texte des messages précédents - > >>>>> -- > >>>>> You received this message because you are subscribed to the Google > >>>>> Groups "Android Developers" g...- Masquer le texte des messages > >>>>> précédents - > >>>> - Afficher le texte des messages précédents - > >> -- > >> Kostya Vasilyev -- WiFi Manager + pretty widget > >> --http://kmansoft.wordpress.com-Masquer le texte des messages précédents - > > >> - Afficher le texte des messages précédents - > > -- > Kostya Vasilyev -- WiFi Manager + pretty widget > --http://kmansoft.wordpress.com- Masquer le texte des messages précédents - > > - Afficher le texte des messages précédents - -- 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