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
Developer
flynch
Posts: 33
Registered: ‎11-20-2008
My Device: Not Specified
Accepted Solution

direct tcp socket connection over wifi

Hi Folks,

I'm trying to make a direct connection over wifi with the latest 4.7.0 JDE, testing in the simulator (9530) and my bb Bold. I'm trying to connect with some code like the following:

 

import javax.microedition.io.Connector;
import javax.microedition.io.StreamConnection;


String URL = "socket://192.168.1.88:31339;interface=wifi;deviceside=true";

connection = (StreamConnection)Connector.open(URL);

 

But I'm not having any luck. I though (from reading the docs) that adding interface=wifi & deviceside=true to the connection string was all thats needed. Am I missing something obvious here?

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

Re: direct tcp socket connection over wifi

You are not missing anything obvious - it is not supported.  See this post:

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=12151&query.id=21...

Developer
flynch
Posts: 33
Registered: ‎11-20-2008
My Device: Not Specified

Re: direct tcp socket connection over wifi

Thanks for the response Peter. Whats a little odd is that I'm unable to connect to any local services on my wifi (192.168.1.x) even via the bb browser on my phone... I'm connected to a bb enterprise server, so I'm guessing that it wants to tunnell all traffic with MDS. Is there any way to disable MDS and allow local wifi connectons while preserving enterprise email, calendar etc?
Developer
flynch
Posts: 33
Registered: ‎11-20-2008
My Device: Not Specified

Re: direct tcp socket connection over wifi

changing:

options -> advanced options -> browser-> Default Browser Configuration to Hotspot Browser seems to allow the browser to connect to 192.168.1.x ....

But I'm still trying to figure out how to get my app to open a connection to a local endpoint. :smileysad:

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

Re: direct tcp socket connection over wifi

I presume you have reviewed the Network Transports video:

http://www.blackberry.com/DevMediaLibrary/view.do?name=NetworkingTransports

 

You will find a number of WiFi related Threads on this forum, which contain interesting information.  I would suggest you check out these ones.  There are others, but I think your questions are answered in these ones.

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=16000

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=898

Developer
flynch
Posts: 33
Registered: ‎11-20-2008
My Device: Not Specified

Re: direct tcp socket connection over wifi

Peter, it appears to be connecting now thanks again. Deploying and debugging this on the device certainly slows the dev cycle but at least its workinig now.
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: direct tcp socket connection over wifi

My communication routines have code like:

 

String connectionSuffix = ";deviceside=true;apn=...."

if ( DeviceInfo.isSimulator() ) {

 connectionSuffix = ";deviceside=true";

}

String completeURL = target + connectionSuffix;

 

This means I can do network testing easily on the simulator.

 

Hope this helps.

Developer
flynch
Posts: 33
Registered: ‎11-20-2008
My Device: Not Specified

Re: direct tcp socket connection over wifi

thanks for the tip.. I'm also controlling this app via a trackwheel (targeting the bold here) so the simulator is of diminished value... unless I downgrade my JDE or find a way to run the 9000 simulator on 4.7.0.
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: direct tcp socket connection over wifi

Should have spotted this earlier.  You should be developing on JDE 4.6 if you are targetting a 4.6 device.  The OS level on the dei=vice is the highest level JDE that you should use with that device.  So you really need to install JDE 4.6 (which of course comes with a Bold simulator!)

 

Re the instalation of Simulator to JDE, don't know how useful these two might be.

 

How To - Connect the JDE to a specified simulator bundle
Article Number: DB-00059
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800901/How_To_-_Conne...

Support - BlackBerry JDE does not recognize previously installed simulators
Article Number: DB-00596
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800792/801083/Support...

Developer
flynch
Posts: 33
Registered: ‎11-20-2008
My Device: Not Specified

Re: direct tcp socket connection over wifi

thanks again, I'm quite new to blackberry development so I appreciate your help/advise bigtime! I'll downgrade to the 4.6 JDE asap.