Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry Web Services

Posts: 12
Registered: ‎08-19-2010
My Device: Not Specified

Input Stream read speed using BES

Hello All,


I have a j2me application which attempts to connect to a web application.  It streams data over http to the app waits for a response and parses the response.  The response is only about 100 characters.  Bellow is the original code we used to pull the data off the input stream.  I added logging in an attempt to sort out why we seem to get a 2 minuite (roughly) delay before the call completes.  The block happens around the is.read function.  It then picks up and completes correctly. 


ByteArrayOutputStream bos = new ByteArrayOutputStream();
        int progress2 = 0;
        int progress = 0;
        int BUFLEN = 1024;
        byte[] buff = new byte[BUFLEN];
        int counter = 0;
        do {
            Logger.monitor("Read start");
            counter = is.read(buff, 0, BUFLEN);
            Logger.monitor("Read Done");
            if (counter > 0){
                if (progress2++ > 10){
                    progress2 = 0;
                    if (++progress > 30)
                        progress = 0;
                Logger.monitor("Write Start");
                bos.write(buff, 0, counter);
                Logger.monitor("Write Done");
        } while (counter > 0);
        return bos.toByteArray();

 In an attempt to sort this out we changed the method to work as bellow. Logging as we go.  The Method bellow pauses again for nearly 2 minutes on the very last byte of the stream.  I have no idea why this is.


 DataInputStream dis = new DataInputStream(is);
        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        int result = dis.read();
        while(result != -1) {
            byte b = (byte)result;
            Logger.monitor("byte: ");
            result = dis.read();
        return buf.toByteArray();

 The most important thing to note is that everything works perfectly when we're not using the BES.  When we remove the web app from the bes system there is no 2 minute delay.  Any help would be greatly appreciated.


Thanks in advance.


Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Input Stream read speed using BES

You will need to investigate the BES MDAT logs. For any support with gathering or reading these logs to find the source of the delay please post to the BES board:


Goodbye everybody!