Time increasing while sending data via http repeatedly on the storm

Hi all!

My application sends data (in general, this is a picture of ~ 1200 Kb) to the server via http.

The data are sent ok, but the when I send data several times (without leaving the application) the time devoted to writing the data in the outputStream develops. On first use, it takes usually ~ 50 seconds, the second seconds of ~ 70, the third seconds from ~ 100... I see this problem only on the storm, others (Curve 8900, Bold, Tour) are OK. The url is used on Storm is: http://xxxxxxxxxxxxx.com/mobile/mobile.asmx;deviceside=true

Here is the code snippet:

private static WSResponse send(byte[] xmlBytes, WSResponseParser parser) throws Exception {

        HttpConnection connection = null;
    OutputStream outputStream = null;

       try {
            connection = (HttpConnection)Connector.open(WifiChecker.getURL(URL), Connector.READ_WRITE, true);

            connection.setRequestMethod(HttpConnection.POST);
            connection.setRequestProperty("Content-Type", CONTENT_TYPE);
            connection.setRequestProperty("Content-Length", String.valueOf(xmlBytes.length));

            outputStream = connection.openOutputStream();

            int offset = 0;
            int chunk = DATA_CHUNK_SIZE; // 1024
            int len = xmlBytes.length;
            while (offset < len) {
                if (offset + chunk >= len) { // avoiding OutOfBounds Exception
                    chunk = len - offset;
                }
                outputStream.write(xmlBytes, offset, chunk);
                offset += chunk;
            }

            xmlBytes = null;

            String response = getResponseAsSting(connection);

            WSResponse wsResponse = null;
            try {
                wsResponse = parser.getWSResponse(response);
            } catch (Exception e) {
                throw ApplicationException.invalidWsResponse();
         }

            if (!wsResponse.isSuccess()) {
                throw new WSFailureException(wsResponse);
            }

            return wsResponse;

        } finally {
            IOUtils.safelyCloseStream(outputStream);
            IOUtils.safelyCloseStream(connection);
            if (xmlBytes != null) {
                xmlBytes = null; // notify VM it can safely free the RAM
            }
        }

I thought it may be a memory problem, so I manually cancel xmlBytes, but which does not solve the problem.

Any ideas?

Thanks in advance,

Arhimed

P. S.

There is no question about Simulator, only on a real device of the storm.

MSohm, thanks for your response.

Fortunately, I have just fixed the problem. The problem was not in the code above, but in the code that made the xmlBytes. I converted bytes of the image base64 and looks like I did it dangerously on the use of the memory.

Thanks again for your attention to this thread!

Tags: BlackBerry Developers

Similar Questions

  • sign the document with 'Draw my signature' and send it via http-post

    Hello

    I have a pdf document with a signature field. When im opening with AcrobatReader XI, I can sign / Place Signature / draw my signature. I can't 'save a copy '. It works pretty well.

    Now, I place a button in the pdf document to be sent via http post to a given address. When I now open this PDF in the XI AcrobatReader, trying to sign. I can only do this with sign / Place Signature / use a certificate. But there is no way to "draw my signature."

    Did I miss an option to do this? Pls tell me if he has a chance to sign the document with 'Draw my signature' and send it via http-post.

    Or is this part of the concept? When I'm looking for a solution, I found EchoSign electronic signature.

    What is available depends on how the as is put in place. If you include a button with an action of type 'Submit form' and/or reader - enable the form, then e-signature (signature of drawing) will not be available in the player. If the document is compatible player then digitally signing will. So for what you want, do not Reader-enable the document and you can use the submitForm JavaScript method to submit. The site that has the JavaScript documentation was not available at the time I wrote this, but post again if you need help with that.

  • How to send data via TCP

    Hi all

    I am trying to write a very simple application that will transfer data via TCP to another computer running a TCP server. (About 3K of data)

    Although I followed the code example in the 4.6 Java Development Guide, page 101, on the use of the socket connections, (http://na.blackberry.com/eng/deliverables/3802/development.pdf) I've been running into questions that data transfer crashes after an undetermined number of bytes.

    Someone at - it sample code to open a TCP connection and sending the data? This seems to be a very common thing to do, so I don't know what is my problem.

    Thank you
    Daniel

    I'm not going to answer your first question, I think that we must resolve this problem before you watch something else (and I suspect they are all related).

    I would almost guarantee that you run your socket send and receive on the thread of events.  The thread of events, that's what treats your interaction Menu, trackball movement etc.  If you perform a long running or blocking on this Thread, your device will freeze.

    Look at the demo of Socket and move your network of transformation to a Thread separate, as does the sample.

    To confirm that the treatment of your socket is executed on the event Thread, you can add this code, run it in the Simulator and watch it in the output window of the debugger and set a breakpoint on the line to System.out.

    If {(Application.getApplication (), isEventThread ())}

    System.out.println ("running in the thread of events and should not be");

    }

  • I believe that Mozilla Thunderbird is slow while sending a message by copying to the sent box. I have multiple accounts, so implementation of tiles help!

    I feel as many times is slow to send the message in Mozilla Thunderbird. Where, as in my Android phone, I could send a message very fast.

    One thing is implementation on the tiles on the homescreen allows to scroll too many accounts. The interface is too basic. Sorry if am not mistaken.

    Thunderbird sends slow by most standards, leaving the sending dialog box until he receives a message from the server that it contains the message, and send. Most programs send background and Thunderbird can do so, but reporting of errors in transmission is eager. You can activate the sending in the background by setting mailnews.sendInBackground to true in the configuration editor and sending of Thunderbird will be much faster. But you might want to watch the dependent bugs on this bug. before you "do" to make sure that you can live with the consequences. Most users will not have a problem.

  • Says "sending data..." "and the printer does print (photosmart c440 &amp; macbook pro snow leopard)

    Hi, my photosmart C440 printer suddenly stopped working print and custom. The message says "Sending data...". "forever but never prints. The printer is on but does not respond to what it says my computer. I have a macbook pro snow leopard OS. This has never happened before, I did not any changes to the system. When the problem appeared first of all, I reinstalled the driver and was able to print once and then it stopped working. Then I installed snow leopard and it stil does not work.

    Thank you!

    We will restore the print system:

    -Sys Prefs, Print & Fax
    -Right (control) click inside the box that lists your printers and select Reset Printing System.
    WARNING - This will remove ALL your printers!
    -Select the sign + to add again. Search for the printer, select it, and wait until the button 'Add' becomes available. Until it clicks.

  • OutofMemoryException/EOFException when bleow data via HTTP POST

    Hello

    I got OutofMemoryException when I download data with size larger than 2 MB. I use http post by specifying

    'Content-Type', ' multipart/form-data; Boundary = boundaryvalue.

    in the header of the request.

    The stacktrace of the exception of 9000 "BOLD" is as below.

    No detail message

    net_rim_cldc (4AAABCA5)

    DataBuffer

    ensureBuffer

    0 x 3690

    net_rim_cldc (4AAABCA5)

    DataBuffer

    To write

    0x3C52

    net_rim_crypto_1-3 (4AAAC974)

    TLSOutputStream

    To write

    0x45C7

    net_rim_cldc-1 (4AAABCA5)

    DataOutputStream

    To write

    0x221D

    net_rim_os-2 (4AAAC894)

    ClientProtocol

    0x1A1D

    net_rim_os-2 (4AAAC894)

    ClientProtocol

    writeRequest

    0 x 1422

    net_rim_os-3 (4AAAC894)

    HttpProtocolBase

    transitionToState

    0x33D7

    net_rim_os-2 (4AAAC894)

    ClientProtocol

    transitionToState

    0x23D4

    net_rim_os-3 (4AAAC894)

    HttpOutputStream

    Rinse

    0x334C

    ....

    When I test Simulator 8300, I got EOFException.

    No detail message
    net_rim_os-2
    ClientProtocol
     
    0 x 1917
    net_rim_os-2
    ClientProtocol
    readResponse
    0x148A
    net_rim_os-3
    HttpProtocolBase
    transitionToState
    0 x 1613
    net_rim_os-2
    ClientProtocol
    transitionToState
    0 x 2335
    net_rim_os-3
    HttpOutputStream
    Rinse
    0x157E

    ...

    This code seems to work for the file with a size less than 2 MB.

    Any suggestions would be very appeciated.

    Thank you

    Itthipon

    I was able to replicate that when you use an OutputStream.  OutputStream to DataOutputStream switching enabled me to show 3 MB of data.  Please give that a try and making me know if you encounter other problems.

  • Sending data by HTTP post

    Hey guys, I have struggled with it all morning and have tried various samples without result.

    I have a service I need to view settings and then receive JSON data back. I have questions, get the post data to pass to the service (comes empty). I can't find all the information on messages anywhere on the developer portal either.

    Here is the code for

    
        // Network manager
        mAccessManager = new QNetworkAccessManager();
           if (!mAccessManager)
           {
               qDebug() << "Unable to create QNetworkAccessManager!";
               return;
           }
    
        //  Handle SSL errors
        connect(mAccessManager,
             SIGNAL(sslErrors ( QNetworkReply * , const QList & )), this,
             SLOT(onSslErrors ( QNetworkReply * , const QList & )));
    
        // Convert to string
        QByteArray byteArrayObject;
        byteArrayObject.append("name1=value1");
        // Path to server    QString path = "http://myurl.com/post.php";
    
        // Build request
        QUrl serviceURL(path);
        QNetworkRequest request(serviceURL);
    
        // Post and connect
        mReply = mAccessManager->post(request, byteArrayObject);
        connect(mReply, SIGNAL(finished()), this, SLOT(onFinished()));
    

    Any help / suggestions would be greatly appreciated, thank you.

    I finally got this figured out.

    Missed me a few great lines:

        // For your "Content-Length" header
        QByteArray postDataSize = QByteArray::number(body.size());
    
       // Set Headers
        request.setHeader( QNetworkRequest::ContentTypeHeader,"application/json" );
        request.setHeader( QNetworkRequest::ContentLengthHeader,QString(postDataSize).toUtf8() );
    

    Here is a complete example.

       // Network manager
        mAccessManager = new QNetworkAccessManager();
           if (!mAccessManager)
           {
               qDebug() << "Unable to create QNetworkAccessManager!";
               return;
           }
    
        //  Handle SSL errors
        connect(mAccessManager,
             SIGNAL(sslErrors ( QNetworkReply * , const QList & )), this,
             SLOT(onSslErrors ( QNetworkReply * , const QList & )));
    
        // Convert to string
        QByteArray byteArrayObject;
        byteArrayObject.append("name1=value1");
    
        // For your "Content-Length" header
        QByteArray postDataSize = QByteArray::number(body.size());
    
        // Path to server
        QString path = "http://myurl.com/post.php";
    
        // Build request
        QUrl serviceURL(path);
        QNetworkRequest request(serviceURL);
    
       // Set Headers
        request.setHeader( QNetworkRequest::ContentTypeHeader,"application/json" );
        request.setHeader( QNetworkRequest::ContentLengthHeader,QString(postDataSize).toUtf8() );
    
        // Post and connect
        mReply = mAccessManager->post(request, byteArrayObject);
        connect(mReply, SIGNAL(finished()), this, SLOT(onFinished()));
    
  • Phone to download a lot of data via WiFi only when the charger is plugged - iPhone iOS 9.3.1 6s

    Hello

    Just today, I noticed that my iPhone 6s was download continuously at the speed of the network via WiFi only when is plugged in the wall charger or the USB loader on the computer. As soon as I stop charging the phone, the download stops. I have no idea what download and I'm a little frustrated because my connection high speed/wireless home is capped.

    Sync to iTunes on WiFi and iCloud backups are disabled. I had subscribed to 9.3.2 iOS beta on the registration by registering with my Apple ID last week, but I haven't added the certificate so that it can download OTA or via iTunes. I have no update available on my Apple store as well.

    I noticed the slowdown on my cause of internet connection of desktop computers that my phone of summer download something on wifi while he is in charge and I also saw the use of the network by using "System Monitor" app on the App store.

    Kindly help me to solve this problem.

    Thank you

    I did a factory reset on by phone by "Erase all content and data" and chose to set up as a "new iPhone" after reset done. There are now only apple applications on the phone, I connected to wifi with the charger plugged and the problem persists. I wonder if it was to be an apple iOS update, I am on iOS 9.3.1 and 9.3.2 is still in beta, I'm not sure if there is an apple update going on in the background.

    Kindly help.

  • How can I use notifications to send data from different sources for the same chart?

    Hello

    I use the model of 'Continuous measurement and logging' project comes with LV 2013.

    It is extremenly helpful in understanding the messaging between the acquisition, graphic and loops of newspaper. (Thank you NEITHER!)

    I ran into a snag though.

    I want to change so that my graphic loop receives notifications of data from two sources of acquisition by the declarant.

    I have trouble getting the data from the two sources to display on one graph.

    I've isolated the problem in the attached vi.

    Here's what happens:

    1. I create 2 parallel loops data and send the data to a third parallel loop with the notifiers.

    2. the third loop receives data from one of the loops because one of the authors of just receiving notifications is to expire instead of receive data.

    Can anyone suggest how can I fix?

    Thank you.

    -Matt

    Here's my modification of your VI. I put notes on the block diagram to explain the changes. He uses a queue for data transfer to avoid data loss. It uses a notifier to stop loops. All local variables and value property nodes have been eliminated.

    The way loops are arrested probably let some data in the queue. No more of one or two iterations of each of the loops of data acquisition. If you need ensure that all data has been displayed (or recorded in a real application), then you must stop acquiring loop first and read the queue until you know it's empty and both other loops stopped. Then stop the render loop and release the queue and the notifier.

    Lynn

  • Creation of interface that won't use c $ table while getting data from one table to the other.

    Hello

    That was the question asked in an interview.

    Given the scenario has been that I have two servers say s1 and s2, each containing a database with tables source1 and source2 respectively...

    And I have a target table on server 2 with name target 1.

    Cent were as

    1 can data ufetch target1 source1 without creating table C $? If Yes, how can it be achieved.

    2. how temporary will be created all to get ata in source1 and source2 to target1? Explain the same thing?

    Also I would like to know what is the actual use of the c arrays $? Why they are used.

    I would be very grateful for answers.

    Thank you and best regards,

    Mahesh

    Hello

    Look at these links.

    http://odiexperts.com/why-creating-a-separate-schema-for-temporary-tables-in-ODI/

    Also this

    http://odiexperts.com/direct-load-by-interface-with-no-work-tables/

    Concerning

  • Sends data to a VI to the other

    My test application consists of several VI. One of them is just to enter/modify test information, for example the tester name, date, HAD model names and numbers etc. Another is for entering the data of test equipment (serial numbers, calibration due dates, names of resourse VISA etc.). Third is to measure parameters (frequency, power limits, calendar, etc.). And I VI Reporting using the data entered, measurement and Calibration.

    What is the best way to communicate between these VI? I use global variables, but every now and then I read in this area and other forums that abuse variables is a bad habit and should be avoided.

    The best way is to use the wires in cases where data dependence created by the son is accepatable.  In your case it is not only acceptable mandatory weed. You cannot run the test until the parameters entered.

    I propose an architecture of State machine with States who call the subVIs. Data can be passed on from one State to the other shift registers.

    If parallel execution is required for some parts of the show, then wiring will not work.  A global variable functional or engine of the Action can be better for global variables.  Queues are also a good way to pass data to a parallel loop.

    Lynn

  • Field will not take or send data

    I have a form that I'm trying to update in some internal web application.

    My problem is that the first field of the form seems not to exist.  I can view the field and its properties in the designer and the associated XML source seems valid, but when I export or send shape data nothing gets exported or submitted for the first field.  If I try to open the PDF file with the data via a xdp file, the first field only fill up, but do the rest.

    It seems to me to be successful in deleting field and adding a new, but it seems to greatly increase the size of the file (90ko at least 133 KB, sometimes 300 KB).

    Have I missed something obvious that will make this field export and import its data?

    If not, is there a way to reduce the size of my PDF after that I have delete and re-create the field?

    Thank you
    Kyle

    Hello

    It is your bound control field or not. Maybebecause of bibding you can get posted data on the ground.

    Sometimes after copy/paste some elements on the form, the source xml of the form becomes little wrong, he begins to have a lot of lines like this:

    , due to this size form could be more than 1 MB, the solution is to remove the unnecessary lines.

    BR,

    Paul Butenko

  • Sends data to a form to an e-mail address

    I have a flex form 4, which asks the user to enter his name and address, name and address are 2 distinct areas. There is also a button "submit".

    I would do it like this when the user clicks on the button submit that users name and address is sent to my email address.

    Nobody knows how, preferably using .net or Java, as a language of middleware?

    j.

    Hello

    You can use HTTPService to send data to a script on the side Server (ie: an aspx page), which creates and sends the e-mail. should be plenty of examples if you google it

  • while I connect to my computer with the samsung wave y kies wi - fi computer displays an error as a peripheral denied connection permission, please provide the solution.

    while I connect to my computer with the samsung wave y kies wi - fi computer displays an error as a peripheral denied connection permission, please provide the solution.

    earlier, I used internet and transfer files through this link, but now it is showing the device refused permission. I have checked all the settings, but could not remedy any problem so kindly help me so that I can connect via wifi to my mobile samsung kies.

    Also, I am facing problem in sending files via Bluetooth, and at the same time my mobile can easily transfer the file and the music file actions with my computer via bluetooth which I did not understand.

    Rental offer the solution to both problems. In my computer I have window7 profeessional.

    Marie-Odile THE

    Hello

    1. What is the brand and model of the computer?

    2 have you made any changes to the computer before the show?

    Reinstalling the Kies application and check if it helps.

    See this link:

    http://Windows.Microsoft.com/en-us/Windows7/uninstall-or-change-a-program

    I also suggest you to contact Samsung and check: http://www.samsung.com/us/support/

    Regarding Bluetooth check out these links:

    Open the hardware and devices Troubleshooter
    http://Windows.Microsoft.com/en-us/Windows7/open-the-hardware-and-devices-Troubleshooter

    Bluetooth devices do not work correctly on a computer that is running Windows 7:

    http://support.Microsoft.com/kb/980396

    Also see this link: http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-problems-with-Bluetooth-enabled-devices

    Note: The article mentioned above is also applicable to Windows 7.

    I hope this helps!

  • Is this ok to change the date of a photograph to the 1800s?

    I think I need to change the dates on about 400 pictures.  Enter a return date in the 1800s would cause a problem with the computer?

    This part of my family history project, which I had completely organized events in iPhoto, Photo is now a bunch of totally random photos.  They were initially examined in groups as I found them over a period of years - so in Moments - a big mess.  I had them in events either by individual or their own cell family, and of course I could merge or add however that I had to.

    Don't know yet, but I think that my best option now is to modify the dates first, just to try and get some semblance of order to it, then try to work out a system with Albums.

    Thank you

    Lynne

    I used "Set Date & Time" to put back the date of the year 1000, with no ill effects.

    I did to split times - it is very convenient to separate them all just by moving a few photos in time by 1000 years. So to adjust the dates for 200 years should be no problem.

    To adjust the dates of sins, I use this script: see this tip to user: Script: batch change Date and time on a fixed Date

    https://discussions.Apple.com/docs/doc-8421

    This script allows you to set the date and time of the selected photos to a fixed date, incremented a constant interval, for example a minute. I use it, if I don't know the exact date and time, but I just don't want the time, so photos can be sorted by time.

Maybe you are looking for