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

Native 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
Highlighted
Developer
Posts: 80
Registered: ‎09-03-2012
My Device: 9810
My Carrier: Vodafone
Accepted Solution

Not able to connect to TCP server through APN

Hello All,

 

After googling thoroughly I finally decided to post my problem which is really giving me nightmares.

In my app I am trying to connect to a TCP server using the Network Carrier internet and using following connection string

url="socket://"+ip+":"+port+";deviceside=true;connectionTimeout=30000;apn=;tunnelauthusername=;tunnelauthpassword=;";

I am able to connect to internet through the phone's browser but not able to connect to TCP server through app.

In my device APN authentication is disabled by default and APN,Userid/Password fields are blank thats why i have taken these parameters as blank valued in the connection string.

 

When i try to connect through wifi network using following string

url="socket://"+ip+":"+port+";deviceside=true;interface=wifi;connectionTimeout=30000";

I am able to connect to server but not in the case via APN.

Please help me out..

I am just stuck here and finding no way out.

 

Thanks

Always Success
Developer
Posts: 293
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: Not able to connect to TCP server through APN

post your code..

what is the socket:// prefix? do you mean to use http:// prefix? Your URL also looks malformed - it is missing a '/' after the port number
Developer
Posts: 80
Registered: ‎09-03-2012
My Device: 9810
My Carrier: Vodafone

Re: Not able to connect to TCP server through APN

[ Edited ]

Due to security reasons i cant reveal the IP and port so i am using dummy IP(127.0.01) and port(087) and my URL is

 

socket://127.0.0.1:8087;deviceside=true;connectionTimeout=30000;apn=;tunnelauthusername=;tunnelauthpassword=;

 

I am not using any '/' after port in URL which I use to connect to server using wifi but I am atill able to connect with the server.So I think issuse is not related to '/' after port number and something else is missing or wrong in the URL.

And socket:// prefix is used while connecting to TCP server and http:// prefix is used to connect to HTTP server.In my case I have to connect to TCP server thats why using socket:// as prefix

Always Success
Developer
Posts: 80
Registered: ‎09-03-2012
My Device: 9810
My Carrier: Vodafone

Re: Not able to connect to TCP server through APN

Finally I got the solution to the problem..

I used ConnectionFactory (Network API) to connect to TCP server and connection string used is just

"socket://127.0.0.1:8089"

No need to specify APN,username and password.

following is the code used

		          ConnectionFactory connFact = new ConnectionFactory();
		          ConnectionDescriptor connDesc;
		          connDesc = connFact.getConnection("socket://127.0.0.1:8087");

 

Always Success