BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 03-06-2007, 06:12 PM   #1 (permalink)
New Member
 
Join Date: Mar 2007
Model: 8700
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default httpconnection timeout semantics

Please Login to Remove!

When I set the timeout on an HttpConnection, as in

Code:
HttpConnection conn = (HttpConnection)Connector.open(myURL + ";ConnectionTimeout=120000;deviceside=false");
is this timeout a limit on
(a) the total time a blocking operation can take or
(b) the amount of time a blocking operation can go without receiving data over the connection or
(c) something else

For example, suppose I have the following code:

Code:
HttpConnection conn = (HttpConnection)Connector.open(myURL + ";ConnectionTimeout=120000;deviceside=false");
int rc = conn.getResponseCode();
if (rc != HttpConnection.HTTP_OK) {
    // Handle failure response from server
}
InputStream is = _connection.openInputStream();
int len = (int)_connection.getLength();
if (len > -1) {
    byte[] data = new byte[len];
    is.read(data);
}
Is it possible for the read() call to take more than 2 minutes? For example, suppose there is no signal for 1:59, then the client receives some data, then there's no signal for another 1:59, etc. Is this possible? Or is the 2 min a hard limit on the duration of the read() call?

Thanks in advance...
Offline  
Old 03-13-2007, 09:08 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

bric,
The timeout signals to the thread managing the connection how long to wait before throwing an InterruptedIOException signifying a timeout. Also, in a quirk of java's connection framework, this thread will hold at getLength and throw from there, not read or open, as one might expect.
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

MOTOROLA 48-869580 SILICON NPN TRANSISTOR RF POWER AMP DRIVER NTE350 M9580 1PC
$15.0
MOTOROLA 48-869580 SILICON NPN TRANSISTOR RF POWER AMP DRIVER NTE350  M9580 1PC picture10PCS TIP120 TO-220 Darlington Transistors NPN NEW OX
$1.63
10PCS TIP120 TO-220 Darlington Transistors NPN NEW  OX picture1PCS New 2SC2395 TOSHIBA RF/VHF/UHF TRANSISTOR 2-10H1A C2395
$25.97
1PCS New 2SC2395 TOSHIBA RF/VHF/UHF TRANSISTOR 2-10H1A C2395 picture1PCS New BLF546 Manufacturer:PHILIPS Encapsulation:RF TRANSISTOR
$72.97
1PCS New BLF546 Manufacturer:PHILIPS Encapsulation:RF TRANSISTOR pictureNEW SEMIKRON module SKM145GB174DN
$88.5
NEW SEMIKRON module SKM145GB174DN picture






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