Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5839327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:34:10+00:00 2026-05-22T11:34:10+00:00

we have just started to write Blackberry apps and got strange situation. Our apps

  • 0

we have just started to write Blackberry apps and got strange situation. Our apps work with mobile internet (GPRS, 3G, EDGE) but are not working using wifi connection.

I have tried to change all the settings. But still usually it is just “Tunnel failure” or “connection timed out” errors. The same is with HTTPDemo example.

Could someone help and explain what it is with Blackberry and WiFi?

StreamConnection s = null;
s = (StreamConnection)Connector.open(getUrl() +”;interface=wifi”);
HttpConnection httpConn = (HttpConnection)s;

               int status = httpConn.getResponseCode();

               if (status == HttpConnection.HTTP_OK)
               {
                   // Is this html?
                   String contentType = httpConn.getHeaderField(HEADER_CONTENTTYPE);
                   boolean htmlContent = (contentType != null && contentType.startsWith(CONTENTTYPE_TEXTHTML));

                   InputStream input = s.openInputStream();

                   byte[] data = new byte[256];
                   int len = 0;
                   int size = 0;
                   StringBuffer raw = new StringBuffer();

                   while ( -1 != (len = input.read(data)) )
                   {
                       // Exit condition for the thread. An IOException is 
                       // thrown because of the call to  httpConn.close(), 
                       // causing the thread to terminate.
                       if ( _stop )
                       {
                           httpConn.close();
                           s.close();
                           input.close();
                       } 
                       raw.append(new String(data, 0, len));
                       size += len;    
                   }   

                   raw.insert(0, "bytes received]\n");
                   raw.insert(0, size);
                   raw.insert(0, '[');
                   content = raw.toString();

                   if ( htmlContent )
                   {
                       content = prepareData(raw.toString());                                
                   }     
                   input.close();                      
               } 
               else 
               {                            
                   content = "response code = " + status;
               }  
               s.close();                    
           } 
           catch (IOCancelledException e) 
           {       
               System.out.println(e.toString());                        
               return;
           }
           catch (IOException e) 
           {       
               errorDialog(e.toString());                        
               return;
           } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:34:11+00:00Added an answer on May 22, 2026 at 11:34 am

    Connecting the following way works for me

    HttpConnection connection = null;
    if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) {
             connection = (HttpConnection) Connector.open(url+ ";interface=wifi",
             Connector.READ_WRITE,true);
    } else {
             connection = (HttpConnection) Connector.open(url+";deviceside=true", Connector.READ_WRITE,true);
    }
    

    Please refer the following resource for in-depth understanding and various methods.

    Sample HTTP Connection code and BIS-B Access By peter_strange

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started learning to write apps for android using Eclipse. Where can
I have just started researching creating mobile apps and from what I understand one
Have just started using Google Chrome , and noticed in parts of our site,
Have just started playing with ASP.NET MVC and have stumbled over the following situation.
I'm new to XNA game development and I have just started to write a
I have just started using Sharepoint Foundation 2010 and I'm trying to write a
I have just started trying to learn Git and I have got a little
I have just started Entity Framework & linq and write this query var query
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have just started using silverlight 2 beta and cannot find how to or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.