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
New Developer
rgchan2004
Posts: 5
Registered: ‎05-11-2009
My Device: Not Specified

Blackberry Bold Device serves as socket server with another device as socket client

Hi everyone,

 

New to Blackberry Development, reading and studying the socketdemo which comes with the 4.7 environment. I have rewirtten

 to have one blackberry device serving as socket server, with another blackberry device serviing as socket client. So that one or another can push a file to anyone at will.

 

 

I use this in the server end on a blackberry device.

 

 ServerSocketConnection scn = (ServerSocketConnection)Connector.open("socket://"+ ":4444" + ";deviceside=true;apn=internet" );
            //Dialog.alert("Here after scn");
            String ts = scn.getLocalAddress();

 

to serve as socket server and use getlocal address to retrieve the ip address. The other blackberry device will try to open in the following command.

 

 

String url = "socket://" + ip address obtained from the scn.getlocaladdress + ":4444" + ";ConnectionTimeout=60000;deviceside=true";  
            //String urlStr = url;
           
            /*
                        try {
            sc = (SocketConnection)Connector.open(url);
                if(sc instanceof SocketConnectionEnhanced){

 

..

 

I got a timeout from the client device. Need some help here, or anyone could advice me if this is even possible ? They don't seem to connect to each other.

 

Pls help.

 

desperato :smileyhappy:

 

New Contributor
joshua_gu
Posts: 3
Registered: ‎07-19-2010
My Device: Not Specified

Re: Blackberry Bold Device serves as socket server with another device as socket client

[ Edited ]

I had the same problem, what solution do you have? give me e-mail,

----------------

E-Mail : xxxx@xxx.com

 

EDIT: Personal Information Removed - Info. Such as IMEI, PIN, e-mails and phone numbers are prohibited for security purposes.

 

Developer
Aviator168
Posts: 709
Registered: ‎09-10-2009
My Device: 8520, 8900, 9000, 9300, 9650, 9700, 9780, 9800, 9810, 9900, 9930

Re: Blackberry Bold Device serves as socket server with another device as socket client

This will never work in the real world.