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

Securitron VM600 Vista Magnetic Lock - 600lbs - Dual Voltage
$140.0
Securitron VM600 Vista Magnetic Lock - 600lbs - Dual Voltage pictureTIG 200 Amp Arc/Stick/MMA 2IN1 DC Inverter Welder 115/230V Dual Voltage Welding
$259.0
TIG 200 Amp Arc/Stick/MMA 2IN1 DC Inverter Welder 115/230V Dual Voltage Welding pictureStandard Voltage Sensor Module For Robot Arduino
$0.99
Standard Voltage Sensor Module For Robot Arduino pictureLCN Sentronics Electro Magnet Model 7850SEM Tri Voltage Door Holder Release NEW
$32.5
LCN Sentronics Electro Magnet Model 7850SEM Tri Voltage Door Holder Release NEW pictureDC 20A/200W Car Voltage Current Capacity Power Charge Discharge Battery Monitor
$14.89
DC 20A/200W Car Voltage Current Capacity Power Charge Discharge Battery Monitor picture






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