我有一个 HTTP 连接,由
HttpConnection c = (HttpConnection)Connector.open(url);
其中url
之一是:
http://foo.bar;deviceside=false
http://foo.bar;deviceside=false;ConnectionType=mds-public
http://foo.bar;deviceside=true;ConnectionUID=xxxxxxx
http://foo.bar;deviceside=true;interface=wifi
如果由于设备未连接到网络而无法建立连接,有什么方法可以导致请求立即出错?事实上,在许多情况下超时大约需要一分钟(特别是在第一次调用从网络获取信息时c.getResponseCode()
:)
编辑:我的意思是出错了。在一种情况下,特别是 Wifi,如果 wifi 在超时之前没有打开,它会停留几分钟,我希望它立即停止。