[TIMOB-12846] Android: Timeout property not working for Network calls
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2013-03-26T22:20:31.000+0000 |
Affected Version/s | Release 3.0.0, Release 3.0.1, Release 3.0.2 |
Fix Version/s | 2013 Sprint 07 API, 2013 Sprint 07 |
Components | Android |
Labels | android, mobilesdk, titanium |
Reporter | Ashish Nigam |
Assignee | Ingo Muschenetz |
Created | 2013-02-25T07:42:46.000+0000 |
Updated | 2013-11-07T18:03:54.000+0000 |
Description
Find the sample code below to reproduce the same.
var win = Ti.UI.createWindow({
backgroundColor : '#ffffff'
});
var url = 'https://www.google.com';
if (Ti.Network.online) {
var xhr = Ti.Network.createHTTPClient({
timeout : 0,
validatesSecureCertificate : false
});
xhr.onload = function(e) {// Onload
Ti.API.info('onload:' + this.status + xhr.status + xhr.getStatusText() + JSON.stringify(e));
};
xhr.onerror = function(e) {
alert('e.error:' + e.error + ':status:' + xhr.status + xhr.statusText);
Ti.API.info(JSON.stringify(e));
};
xhr.open('GET', url);
xhr.send();
}
win.open();
timeout=0 is an invalid value. 0 means no timeout.
Hi Ingo, you understood well and yes, i tried various different values and none of them worked. I am reopening this ticket.
I tried various different values and none of them worked. "0" is just an example value.
I just tried hitting http://www.google.com:81 with a timeout property > 0 (I tried 50, 100, 150) (Port hidden behind firewall. Expect timeout). I always got the onError callback. Agreed that the message right now is not descriptive which we will fix. But debugging showed that we did get a ConnectionTimeout exception. Tried this on S3 running 4.1.1 and S2 running 2.3.6.
Verified With - SDK - 3.1.0.v20130409124549 Appcelerator Studio - 3.1.0.201304091724 OS - Montain Lion (v10.8) Verified the last comment made by Vishal and got the same. Hence closing this issue.