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
Highlighted
Developer
Posts: 41
Registered: ‎08-01-2008
My Device: Not Specified
Accepted Solution

Problems with 9000 device making a socket connection?

[ Edited ]

Edit again: still a problem, see update 2 at end..

 

 

My app works fine on 4.3 & 4.5, device and simulator. Also works fine in 4.6 simulator. However, on the new Bolds we just acquired today I cant make the blackberry establish a socket connection! As far as I can tell a call to Connector.open which has the form:

 

 

String connUrl = "socket://<server>:<port>;deviceside=true";
StreamConnection sc = (StreamConnection) Connector.open(connUrl);

 

 .. will never return! I put breakpoints after it in the file and I get nothing. There is no sign of a connection coming through to the other end. I put a breakpoint on the line with Connector.open so I know it is being reach, but if I click "step over" control is never returned to the jde debugger.

 

I realise in 4.6 Application permissions have been moved around, but I've manually set the application to have permission to make connections to the internet. I've even tried connecting to a server I know the blackberry can access (eg www.google.com), I would expect this to then cause an exception further on as my application obviously doesn't speak HTTP.. but nothing! No indication the Connector.open call ever returns. Also no exceptions appear to be thrown, ControlledAccessException or otherwise.. can anyone surmise what might be going on here? It seems like this is such a fundamental thing to be doing, I can't see what might have changed. My thread manager program is still running behind everything (I can see its regular ram usage messages) so it's not like all user applications are crashed or anything.

 

My application is signed, I have checked repeatedly. I can also access the internet as normal from the blackberry browser. It's also worth noting that on connecting the debugger to the device I'm told debug information is missing regarding two modules - net_rim_cldc and net_rim_os if I remember right. It then says due to this "many debugging features will not work correctly", however as far as I can see, debugging features or not, this connection is simply not being established, and yet no exception or anything is thrown. The above code is surrounded by try/catch which will catch java.io.IOExceptions and ControlledAccessExceptions, amongst others, but none of that code is ever hit. And surely if it were some more exotic exception type that I haven't prepared for, I would at least get a popup on the screen telling me about an uncaught exception?

 

Help would be greatly appreciated!

 

 

UPDATE: Standardly, as soon as I had finished my half hour of trying to get this thing to work and then wrote an epic forum post, it starts working. Perfectly as far as I can tell. I guess this could have been a temporary bit of bad service from my provider.. oh well either way we're all good now..

 

 

UPDATE 2: It appears when connecting over wifi this is not a problem, but if I turn off wifi the problem remains. Any ideas?

Message Edited by malcolm on 09-15-2008 12:54 PM
Developer
Posts: 79
Registered: ‎09-15-2008
My Device: Not Specified

Re: Problems with 9000 device making a socket connection?

Hi Malcolm, what is the version ? I have version 4.6.0.120

Because Socketconnection for me works good when i have deviceside = true and  APN with ID and password.For me it only gives problem when i send large data over socket the Connection always times Out .Saying TCP time out.

It only happens when i try to write some thing on the output stream.

BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Problems with 9000 device making a socket connection?

How long have you waited for an exception?  It should time out after 2 minutes if it is unable to connect.  What route are you making the connection over?  Are you using the deviceside parameter? 

 

Has the BlackBerry been activated on a BlackBerry Enterprise Server?  Have you filled out the APN information under Options, Advanced Options, TCP?  Does the BlackBerry show 3G on the home screen (capital G)?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 79
Registered: ‎09-15-2008
My Device: Not Specified

Re: Problems with 9000 device making a socket connection?

When i try to write data in a Loop say for 100 times after 35% it stops and then after 2 mins it gives me I/O Exception. TCP timeout.

 

The Code is:

 

try

{

_conn = (SocketConnection)Connector.open(

url,

Connector.
READ_WRITE,

true

);

//

_conn.setSocketOption( SocketConnection.KEEPALIVE, 1 );

 _conn.setSocketOption( SocketConnection.LINGER, 5 ); 

}

url is  :   socket://66.18.118.80:80;deviceside= true;apn=(WapGatewayAPN);TunnelAuthUsername=();TunnelAuthPassword=();

 

ie...Route is Direct TCP stack.

The APN information is filled under TCP and also the Blackberry shows 3G.

what is this Blackberry activated on Blackberry Enterprise server.? how to get this done.

BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Problems with 9000 device making a socket connection?

Let's keep this issue in the thread you started as to not duplicate posts.

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=4757#M4757

 

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 41
Registered: ‎08-01-2008
My Device: Not Specified

Re: Problems with 9000 device making a socket connection?

My apologies, this is a stupid mistake on my part. Hadn't filled in the APN settings. Everything appears to be working fine now.