0

When I run HttpDemo of 'Blackberry samples' on a 5.0 device, I get an exception:

net.rim.device.internal.io.CriticalIOException: Critical tunnel failure

But it works fine in the simulator. What are the possible reasons for this exception, and what are ways to overcome it?

Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
Jisson
  • 3,566
  • 8
  • 38
  • 71

2 Answers2

3

There are various ways to make an HTTP connection on the BlackBerry depending on what model you have and what carrier you're using. The best solution is to use Versatile Monkey's network helper class. It queries the service books on the system to find the right way to make a connection.

Eric Giguere
  • 3,495
  • 15
  • 11
1

Critical tunnel failure indicates that your device has not properly configured APN setting in Options>Advanced Option>TCP/IP. the APN is provided by your service provider. You also can use Wifi as an alternate. But if you want to use Direct TCP you have to provide APN.

Adil Soomro
  • 37,609
  • 9
  • 103
  • 153
  • Thanks Adil,I handle the bug.Now I use the apn name directly in the connection string,For making it dynamic I use the follwing code : ServiceRecord[] records = ServiceBook.getSB().getRecords(); String uid = records[3].getUid(); String cid = records[3].getCid(); ServiceRecord record = ServiceBook.getSB().getRecordByUidAndCid(uid, cid); String tcpAPN = record.getAPN();But its not working I got tcpAPN as null.Do you have idea to over come it. – Jisson Feb 08 '11 at 12:36
  • When using Connection parameter as deviceside=true. You dont need to provide the apn setting in the code. The device itself get it from the configurations. My point was, Have you provided the correct APN. To check it Go to your Menu the Options > Advanced Option > TCP/IP. Check its accuracy according to your carrier. – Adil Soomro Feb 08 '11 at 12:55
  • Ok Thanks Adil, I think for using the application user has to manually set the apn in his cell isn't it? Is there any way get apn with out force the user to enter manuvally? – Jisson Feb 08 '11 at 13:41
  • No you can't, in my point of view. However you can use WAP 2.0 to connect to server and get rid of the APN settings. – Adil Soomro Feb 08 '11 at 13:53
  • The answer by "Eric Giguere" is versatile. you can use it. – Adil Soomro Feb 10 '11 at 05:06