Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 3
Registered: ‎01-30-2010
My Device: blackberry 8310
My Carrier: vodafone india
Accepted Solution

Java.io.ioException: Tunnel Timed out received

Hi,

 

We have developed a Java ME application that has been tested to run fine on Blackberry 9000 using Wifi Interface. Uploaded the application to our server and installed application on device using OTA. The Cod has been signed through Blackberry. Application installs successfully and while it is launched, it tries to connect to our server using HTTP connection. We are using Direct TCP setting with Vodafone (India) APN (tried www, portalnmms and blackberry.net) but with all 3 APNs, the error is the same:

java.io.IOException: Tunnel Timed Out

 

With the URL, ";deviceside=true" is being specified for Direct TCP connection. Default browser setting for HTTP is configured to Internet Browser.

 

Installed HTTPDemo from JDE samples and device and it also gives the same error.

 

Tried contacting the service provider for tunnel error..but no help.

 

Can anyone pls help on this issue? Are there any network tools to diagnose tunnel issues on blackberry?

 

Model: Blackberry 8310

Version: 4.5.0.55 (Platform 2.7.0.68)

 

Thanks,

Bharti

 

 

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Java.io.ioException: Tunnel Timed out received

Try the publicly available NetworkDiagnostics tool from RIM. Also, inspect the Event Log to see whether the right APNs (those that you set in Options -> Advanced Options -> TCP) are really used by the OS -- sometimes WAP 2.0 TCP is used instead.

 

Another thing you could try is take the SIM from this BlackBerry and insert it into a non-BlackBerry phone, say, a Nokia. Then you can check whether that device can connect to the Internet and you could also find out which APN it's using.

New Developer
Posts: 3
Registered: ‎01-30-2010
My Device: blackberry 8310
My Carrier: vodafone india

Re: Java.io.ioException: Tunnel Timed out received

Thanks klyubn for your suggestions. Finally, we managed to run HTTP connection using following:

 

- Integrated service book read utility and searched for WPTCP entry,

- Get the ConnectionUID configured for this entry,

- Append the ConnectionUID str to the end of the HTTP URL

 

The results we have got are the following:

- Runs fine on most networks except Vodafone (India & Worldwide)

 

But the issue that we are facing now is that the connection runs fine for 3-4 runs of the application but after that it fails to open connection, saying Connection Timed Out. By 3-4 runs I mean, today I ran the app and closed it after successful run. Tomorrow I ran it again..ran fine. Next day/next instance of run it may connect to server or may not. Checked for the service of WAP2 gateway of the service provider, it is also fine at that moment. No settings/new applications are loaded are ran on the phone during this time.

 

The way to come out of this Connection timed out issue is to hard-restart the phone. After restart the open connection starts working again.

 

This suggests that there is something wrong with the usage of the service book entries. We are using the following code for service book. Can someone suggest, what could be going wrong here?

 

Code for reading Service book entries:

 

private void getWap2TransportUid()

   {        

//#ifdef BlackBerryPhone

       BBErrorMsg = "xxx";

 

       if(DeviceInfo.isSimulator())

       {

           ConnectionSuffix=";deviceside=true";

           BBErrorMsg += "BB on Simulator, returning ';deviceside=true'";

           friendlyException1(BBErrorMsg);

           return;

       }

       else if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED && RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN))

       {

           ConnectionSuffix=";interface=wifi";

           BBErrorMsg += "BB on WiFi, returning ';interface=wifi'";

           friendlyException1(BBErrorMsg);

           return;

       }

 

       String flow="",flow1="";

       int i=0, numOfRecords=0;

       try

       {

           String cid, uid;

           ServiceRecord serviceRecord;

           //System.out.println("In getWap2TransportUid");

           // Get the service book records for WAP2 transport.

           ServiceRecord[] records = ServiceBook.getSB().findRecordsByCid("WPTCP");

           numOfRecords = records.length;

           //System.out.println("----got the ServiceRecord----");

           flow = "There has been "+numOfRecords+" BBServiceUID(s) available:";

           for (i = 0; i < numOfRecords; i++)

           {

               serviceRecord = records[i];

               flow +="\n("+(i+1)+") "+"Record Name:"+serviceRecord.getName()+", ";

               cid = serviceRecord.getCid().toLowerCase();

               flow += "CID:"+cid+", ";

               uid = serviceRecord.getUid().toLowerCase();

               flow += "UID:"+uid+", ";

           }

           //System.out.println(flow);

           friendlyException1(flow);

           BBErrorMsg += "Data Aslant.tifn"+flow;

 

           flow1 += "Getting BBServiceUID out of "+numOfRecords+" found, to be used:";

           for (i = 0; i < numOfRecords; i++)

           {

               serviceRecord = records[i];

               flow1 += "\n("+(i+1)+") "+"Record Name:"+serviceRecord.getName()+", ";

               if (serviceRecord.isValid() && !serviceRecord.isDisabled())

               {

                   flow1 += "Valid and Enabled, ";

                   cid = serviceRecord.getCid().toLowerCase();

                   flow1 += "CID: "+cid+", ";

                   uid = serviceRecord.getUid().toLowerCase();

                   flow1 += "UID: "+uid+", ";

                   if (cid.indexOf("wptcp") != -1 && uid.indexOf("wifi") == -1 && uid.indexOf("mms") == -1)

                   {

                       flow1 += "Required UID found :"+uid;

                       friendlyException1(flow1);

                       ConnectionSuffix=";ConnectionUID="+uid;

                       BBErrorMsg += "\nData Bslant.tifn"+flow1;

                       break;

                   }

                   else

                       flow1 += "Return check fail, ";

               }

               else

                   flow1 += "This record is NOT Valid OR is Disabled, ";

           }

           if(ConnectionSuffix.equals(""))

           {

               ConnectionSuffix = ";deviceside=true";

               flow1 += "No Valid or Enabled UID found, ";

               flow1 += "Returning UID : "+ConnectionSuffix;

               friendlyException1(flow1);

               BBErrorMsg += "\nData Bslant.tifn"+flow1;

           }

           //System.out.println(flow1);

       }

       catch(Exception ex)

       {

           friendlyException(ex,"HTTPHandler.java : getWap2TransportUid("+flow+" : "+flow1+")");

           //System.out.println(flow+"\n"+flow1);

           ex.printStackTrace();

       }

       flow=null;

       flow1=null;

//#endif        

}