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

Reply
Developer
MFSI
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
Please use plain text.
Developer
strobejb
Posts: 276
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
Please use plain text.
Developer
MFSI
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
Please use plain text.
Developer
MFSI
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
Please use plain text.