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
Posts: 209
Registered: ‎11-08-2008
My Device: Not Specified

Unable to make connect with the Socket Server

Hi All,

I am developing an application using BlackBerry JDE ,where, i have to access through Socket Server.

my code is given below..........

SocketConnection sc = (SocketConnection)
                                Connector.open("socket://"+"192.168.1.110"+":"+"8080"+";deviceside=true");        System.out.println("request has been forwarded 2222");                       
sc.setSocketOption(SocketConnection.LINGER, 5); 

is  = sc.openInputStream();                 
 os = sc.openOutputStream();

 

but its unable to make connection,andthroughing Exception as Java.io.IOException - Open tunnel - max timeout.

 

And when i made ";deviceside=false", then it not throughing this Exception ; but my Socket Server is not listening its request.May be there is something minnor problem with the BlackBerry JDE settings.or anything else which i am missing. Please reply me...............

 

Thanks

Mudassir

Thanks and Regards
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Unable to make connect with the Socket Server

Can you confirm that you are trying to use a Socket Connection to a Server running on "192.168.1.110"?

 

Are you running this code on the BlackBerry or Simulator?  If the simulator, when you use deviceside=false, are you running the MDS Simulator?  Is there a Web Service on this address that you can access via the Browser to confirm connectivity?

Developer
Posts: 209
Registered: ‎11-08-2008
My Device: Not Specified

Re: Unable to make connect with the Socket Server

YEs i am testing on Simulator. This Simulator is provided with the BlackBerry JDE 4.3.0. So i am not sure about MDS simulator. And my Socket Server is listening when i run that application by using Net-Beans.

 

Thanks for Replying..........

Thanks and Regards
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Unable to make connect with the Socket Server

[ Edited ]

I would suggest that we try running with the MDS because it produces a log of its activity.  You will find the MDS in Start-->Programs-->RIM-->BlackBerry JDE 4.3-->MDS - i.e. the same place you use start the JDE.  Alternatively you can have the MDS always come up, by doing the following in the JDE:  Edit-->Preferences, select Simulator Tab, the check the box that says "Launch MDS with Simulator".

 

So start the JDE, change your app to ";deviceside=false", start the simulator, and start MDS (if not started automatically).  Try your application and note what happens in the MDS log - this is the "DOS Console" that should appear when you start MDS.  I'm hoping you will see some activity there and be able to figure out what is going wrong.

 

You should of course be able to ping your Server IP address from the PC that is running the Simulator - can you confirm that is the case?  Also normally 8080 is a Web Server alternate address rather than a socket connector address, are you sure that you Server is listening on 8080.

 

Let us know how you get on.

Message Edited by peter_strange on 12-03-2008 10:13 AM
Developer
Posts: 209
Registered: ‎11-08-2008
My Device: Not Specified

Re: Unable to make connect with the Socket Server

Thanks for Reply...

I opened the MDS DOS console,but nothing happened in that. And I am getting still the same exception.

Please tell me that is there any APN setting required when making connection through Simulator.

 

Thanks

Thanks and Regards
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Unable to make connect with the Socket Server

When you start the MDS Simulator, it will start a 'Command' window (one of the Black MS-DOS ones) and dump loads of text into it as it is progressing.  If you do not see this window, or it appears and disappears, then do you do not have the MDS started.  Can you try the MDS Simulator and let us know what you do see.  There are Threads in here and articles in the KB that deal with what to do if your MDS doesn't start.

 

Re APN settings, the answer is none.  You just specify ";deviceside=true" and it will work, without MDS, on the simulator, with no specific APN settings.

Developer
Posts: 209
Registered: ‎11-08-2008
My Device: Not Specified

Re: Unable to make connect with the Socket Server

Yes, Command' window (one of the Black MS-DOS ones) is displayed, and, dump loads of text into it as it is progressing , as you said. But it's displaying loads of <start> and <connect> tags ,where many threads get started. So, I am un able to understand those threads.
Thanks and Regards
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Unable to make connect with the Socket Server

When you connect, you should see in the MDS log, a message like the following:

 

<2008-12-03 18:52:38 GMT>:[49]:<MDS_MDS>:<DEBUG>:<LAYER = IPPP, EVENT = EndExec
ting, TAG = -1492178666, DEVICEPIN = 2100000a, VERSION = 16, CONNECTIONID = 121
984391, SEQUENCE = 0, TYPE = CONNECTION-REQUEST, CONNECTIONHANDLER = , PROTOCOL
= TCP, PARAMETERS = [192.168.1.11:8890], SIZE = 74>

 

The key information is the address, 192.168.1.11:8890, which proves that the application is correctly attempting to connect to the IP Address and port specified (these are parameters that I put in to my processing, you will look for your own address and port).  If you see this in the output, then your Blackberry code is working fine, you have a problem elsewhere in your network.

Developer
Posts: 209
Registered: ‎11-08-2008
My Device: Not Specified

Re: Unable to make connect with the Socket Server

Yes I have checked , and I found no such IP CONNECTION PARAMETER.

I am using "deviceside = true", therfore i am trying to connect directly,and not through MDS.

 

Thanks for reply...

Thanks and Regards
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Unable to make connect with the Socket Server

As noted in a previous post, "I suggest that we try running with the MDS because it produces a log of its activity".  Can you change to using ";deviceside=false".