URLConnection with https fails every other time

by ole! » Thu, 25 Sep 2008 23:46:10 GMT

Sponsored Links
 Can anyone help?

The code below loops 10 times where each loop does a URL connection
using either http or https.
When using http protocol everything works fine.

When using https, every other message is sent correctly while the
incorrect messages fail silently (no message is sent to the server and
no exception is thrown).
We know no packets are sent because we are using echoport to track

If the delay between messages is set to 1ms, then all https messages
are sent correctly.

  private void sendHttpsMsg(long id) {
        String urlString = "";
        //String urlString = "" ;;
                        try {
                                URL url = new URL(urlString);
                                URLConnection connection = url.openConnection();

                                InputStream is = connection.getInputStream();
                                Scanner in  = new Scanner(is);

                                while (in.hasNextLine())
                        } catch (Exception ioe) {

    private class HttpMsgThread extends Thread {
        HttpMsgThread() {
        public void run() {
                for(int i=0; i<10; i++) {
                        try {Thread.sleep(10000);}
                        catch (InterruptedException e) {}


Other Threads

1. Is it possible to wake the device with : PowerManager.WakeLock.acquire()


I have a timer that schedule a task to run every 5 minutes. This task
send a request to a server, so I need to be sure that CPU is on so
that wifi or 3g can be used.

So the first thing I do in my run() method is :

 PowerManager pm = (PowerManager)
 PowerManager.WakeLock wl =
pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My wake Lock");
wl.acquire() ;

and the last thing I do in the run() is :
wl.release() ;   //Ah I would like not to release here to be sure my
service will run in the next 5 minutes :P

The question is : if the device is already in a sleep state, can I
wake up it with my wl.acquire()   ?

Any help appreciated.


2. Meeting Point @WonderGirls

Mrk extend ga sih c*k? Ampe bsk?

my problem is you...

Yang mau PickUp Tiket, yuk buruan...

Running out nih, banyak bener pesertanya... Cari poster itu yah, sama
figuranya :p
how to froyo a Desire:
 http://alturl.com/ddf8 <---JN powered

"Indonesian Android Community [id-android]"

3. creating and opening sqlitedb on sdcard for api7

4. what kind of Android Virtual Device can be used as the emulator for ADP2

5. CyanogenMod 5.0.8 for Nexus One STABLE!!

6. OOT: LIVE from Balai Kartini

7. OOT: ABG Berjibun