BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 06-19-2005, 10:31 AM   #1 (permalink)
New Member
 
Join Date: Jun 2005
Model: 7520
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default HTTPConnection fails for large data

Please Login to Remove!

Hello all - hoping one of you have seen this...

In a nutshell, reading from an HttpConnection's InputStream doesn't read all the data. read() returns -1 somewhere between 3K to 5K (it's random and never the same place) into an 8-10K http page, causing my app to fail. I'm not doing anything unusual - just the standard:
while ((ch = is.read()) != -1) {
strBuff.append((char) ch);
}

The http response is chunked, so the contentlength isn't available, that's why I'm doing this type read. If the HTTP response is less than 3K bytes I can receive it fully and my app works fine. The built-in browser on the device can retrieve the same exact URL (all 8-10K of it) from the exact same location.

This is running in its own thread, too. The only potential problem I can see is that I have a TimerTask kicking off every 2 minutes using a different HTTP thread to open an HTTP URL (it sends an update to a web service). I don't think the two threads are conflicting... only one of them is running at a time. How many concurrent HttpConnections does the RIM7520 support? I thought it was 4. I'm not getting any exceptions that it cannot open any more HttpConnections, so I have to assume this isn't a problem.

The thing that's really messing with my head is that this works PERFECTLY in the simulator!!! What's different between the simulator and the device in this regard? Just the Nextel network, right? Am I hitting some timeout? I'm not getting an InterruptedIOException (I'm asking for them when I open the HttpConnection). Here's how I get an HttpConnection:
httpConnection = (HttpConnection) Connector.open(m_sURL,
Connector.READ_WRITE, true);


ANY ideas would be MOST gratefully accepted - this is driving me insane!

Thanks,

Bret
Offline  
Old 06-20-2005, 09:23 PM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Feb 2005
Model: 7280
Carrier: cingular, no wait, AT&T
Posts: 300
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think HTTP connections just plain won't work after a certain size. We had the problem, and compressed what we were requesting. Not a very good compression, but one none-the-less.
Offline  
Old 06-21-2005, 02:32 PM   #3 (permalink)
New Member
 
Join Date: Jun 2005
Model: 7520
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Rats, I have NO control over the sending site . Looks like I may have to rethink my plan, which is going to cost me $75K or more.

Thanks for the reply.

Bret
Offline  
Old 06-24-2005, 08:22 PM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2004
Location: Metro NYC
Posts: 175
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

For what its worth, RIM recommends keeping transmissions to about 2k in size.
__________________
-- Aric Rosenbaum
BlackBerry consulting, BlackBerry development
www.arconsultinginc.com
BlackBerry consulting and development (RIM SI Partner)
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.