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
New Developer
Posts: 1
Registered: ‎02-25-2009
My Device: Not Specified

ServerSocketConnection

[ Edited ]
Hello,
I am trying to create a server socket on my BB 8120 v4.3.0.115 while using only WiFi (no sim card in the device).
For that I tried the sample given in the documentation under Interface ServerSocketConnection.
I modified theConnector.open call by passing it Connector.open("socket://:15234";interface=wifi);
I am using JDE 4.3.0.

Meanwhile I also checked the SocketDemo example provided with the api. It works for Computer (server) -- BB device (client) configuration using WiFi on the same device.

Seems that the serverSocket does get created on the device, just that no communication takes place.
It keeps on waiting on the call to acceptAndOpen().
I tried connecting to the serverSocket by doing -- "telnet 172.16.1.150 15234" from the computer command prompt.
I spawned a new thread and have the following code in the run():

String url = "socket://:15234;interface=wifi"; scn = (ServerSocketConnection) Connector.open(url); System.out.println("server socket conn = " + scn.toString()); System.out.println("address = " + scn.getLocalAddress()); System.out.println("port = " + scn.getLocalPort()); System.out.println("wait for an incoming connection"); // Wait for a connection. sc = (SocketConnection) scn.acceptAndOpen();

...

...

..

I see the following output:

 

server socket conn = net.rim.device.cldc.io.tcp.TcpServerSocketConnection@3bc630f
address = 172.16.1.150
port = 15234
wait for an incoming connection

 

Am I missing something here?
Thanks.
Message Edited by timtim on 02-25-2009 09:25 PM
Developer
Posts: 136
Registered: ‎02-12-2009
My Device: Not Specified

Re: ServerSocketConnection

Hi,

may be you should try this,

 

String url = "socket://172.16.1.150:15234;deviceside=true;interface=wifi";
scn = (ServerSocketConnection) Connector.open(url);
 

 

If this works mark it as SOLUTION!!

 

Regards

SmartFish

_____________________________________________________________________

Thank the person who helped you by clicking Kudos! star near their post..
If you start a new thread, then resolve it using Accepted Solution button..
Leave solved threads for reviewing purposes - Start a new thread for new questions..
Developer
Posts: 293
Registered: ‎02-25-2009
My Device: Not Specified

Re: ServerSocketConnection

Can we assign , an IP address to my serversocket on BB device? your code is hanging my device.
New Developer
Posts: 9
Registered: ‎03-04-2009
My Device: Not Specified

Re: ServerSocketConnection

 



 

String url = "socket://172.16.1.150:15234;deviceside=true;interface=wifi";
scn = (ServerSocketConnection) Connector.open(url);
 

 

 


 

 

Your original code is correct. The code above will create a client connection to the nominated address. The code below should work, however there are considerations about the devices you might use. If you are using a simulator before OS 5.0 you will probably need to drop the interface=wifi part.

 

String url = "socket://:15234;deviceside=true;interface=wifi";
Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: ServerSocketConnection

I was not aware that it was possible to set the IP Address of a BlackBerry device, except possibly the WiFi Address, but even then it would have to match the network in which it was connected.

 

Are you sure this code is correct?