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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Contributor
Posts: 10
Registered: ‎01-22-2013
My Device: Torch 9800
My Carrier: Bell Canada

HttpConnection communications

Hi,

 

I was informed that the transport needs to be specified in the HttpConnection URL.

 

For example, if I want to use WiFi I would need to append ";interface=wifi" onto the end of the URL, like this:

 

http://www.google.com;interface=wifi

 

Is this true?

 

If true, does it only pertain to certain versions of the OS?

 

Currently, I get a "DNS error" when I suffix the URL in this way.

 

I would like to understand why I get a "DNS error" and how to correct my code so WiFi is used whenever possible.

 

Thank you.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: HttpConnection communications

The BB uses a 'connection suffix' to specify the communication path that then request will be directed over.  To understand the possible options see this video:

http://supportforums.blackberry.com/t5/Java-Development/Networking-Transports-II/ta-p/446742

 

This KB article details the available suffixes:

http://supportforums.blackberry.com/t5/Java-Development/Different-ways-to-make-an-HTTP-or-socket-con...

 

Now I recommend that instead of worrying about which suffix to use, you can use ConnectionFactory and let it worry about it for you.

 

There is more on this recent Thread:

http://supportforums.blackberry.com/t5/Java-Development/Get-string-from-url/td-p/2099773

 

Now this doesn't specifically help you.  In your case you have chosen WiFi and correctly specified the connection suffix that will direct your request over WiFi. 

 

I have not really studied it, but I have seen DNS issues on device when they have been recently switched to WiFi.  My experience is that this will settle down.  My impression of this processing is that the WiFi routing actually attempts to resolve the IP Address for itself.

 

But this is hypothetical.  Can you tell us more about the environment for your DNS error.  Is it on device or Simulator?  What OS Levels are involved in development and on device/Simulator?  Does it take 2 minutes to get this error or does it happen quickly.  What is the URL you are trying to reach?  Is the URL accessible on the device's Browser? 

Contributor
Posts: 10
Registered: ‎01-22-2013
My Device: Torch 9800
My Carrier: Bell Canada

Re: HttpConnection communications

Thank you very much for your very informative and helpful post, Peter.

 

>  Can you tell us more about the environment for your DNS error.

 

Absolutely.

 

> Is it on device or Simulator?

 

Device -- Torch 9800

 

>  What OS Levels are involved in development

 

5

 

> and on device/Simulator?

 

6

 

>  Does it take 2 minutes to get this error

> or does it happen quickly.

 

It takes a while (perhaps 2 minutes).  It seems like a connection timeout.

 

>  What is the URL you are trying to reach?

 

http://omniscience.cloudapp.net/collector/service.svc/Register/1

 

>  Is the URL accessible on the device's Browser?

 

Absolutely.

 

 

Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: HttpConnection communications

OK, All looks like it should work.

 

I'm not sure I can really help here, but I would like to do some more investigation.

 

In Manage connections, turn everything off, then turn WiFi back on.  Leave it for a bit until the WiFi indicator is showing.  Then try again in Browser and in program. 

Contributor
Posts: 10
Registered: ‎01-22-2013
My Device: Torch 9800
My Carrier: Bell Canada

Re: HttpConnection communications

Thank you for trying and for the additional information in your initial reply.
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: HttpConnection communications

Sorry that should have read:

 

I would like you to do some more investigation.  Please try out the Manage Connection test.