Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
01-19-2011 01:26 AM
I am using httpconnection to download images from a remote server.And in my application there are 20 or more images to be downloaded. When i start my application for the first time, mostly i am able to run the application.But when its second or third time i am gtting some error message and the images are not properly downloaded. I get messages like stream closed. TCP error(getting very rarely).
Why this happens the app works correctly on simulator..????
Is it because in the thread i am using multiple http connections to download the images..So each connection starts before the first one completes...If the error is happening due to this case how can i run the app for the first time without any error..
Any replies please...
01-19-2011 01:48 AM
there is a limit on simulatanious connection open.
I will suggest that make sure you closed prev connections before open a new connection.
01-19-2011 01:53 AM
Maximum connections are some 20...But i tried limiting the connection to two(2) this also failed when i tried it some two three times.ie the app worked ine for the first two times and then failed. sometimes iam getting timed out exception also.
01-19-2011 02:07 AM
One more thing, since i am using thread. The threads run method is called almost simultanoeusly so soon after opening one connection next threads run is called and opens other connection.
01-19-2011 04:37 AM
Two points to think about:
1) Connections can be broken for any number of reasons, such as moving out of coverage, taking a phone call on a non 3G connection. Are you sure what you are seeing is not just the result of chance? Your downloads are going to fail sometimes, you need to put logic in to retry them.
2) Have you thought of creating a 'Server' model where you have a pool of download Threads waiting for work - you add work to a queue for these Threads to process? That way you can easily control the number of active Threads.
01-19-2011 11:10 PM
The problem occurs while reading the inputstream to a byte array.
When i debug by attching my device it seems that it works fine for reading the images the first one two times and then throws exception while i tried to read the input stream data.
The exception thrown is Stream closed exception..