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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Contributor
tramntn
Posts: 39
Registered: ‎04-20-2010
My Carrier: Developer

ServerSocketConnection problem with acceptAndOpen()?

Hi everybody i try to make connect with ServerSocketConnection, when it run into line socket.acceptAndOpen().have nothing to returns, just stuck on that

 

 

ServerSocketConnection server = (ServerSocketConnection)Connector.open("socket://:;interface=wifi;deviceside=true");

HttpServerConnection conn = (HttpServerConnection) socket.acceptAndOpen();

 

Does anyone know how to solve it please help!

 

Thanks in advance

Please use plain text.
Contributor
tramntn
Posts: 39
Registered: ‎04-20-2010
My Carrier: Developer

Re: ServerSocketConnection problem with acceptAndOpen()?

 no help :smileysad:

Please use plain text.
Developer
peter_strange
Posts: 17,958
Registered: ‎07-14-2008

Re: ServerSocketConnection problem with acceptAndOpen()?

acceptAndOpen(); is used for listening connections, in other words, to let other people connect to your BlackBerry.  It will return when someone tries to connect.

 

Is that what you were trying to do?

 

If you were trying to create a standard socket connection to a server, then I recommend the socketdemo sample.

Please use plain text.
Contributor
tramntn
Posts: 39
Registered: ‎04-20-2010
My Carrier: Developer

Re: ServerSocketConnection problem with acceptAndOpen()?

thank you for you answer. i 'm trying to do with push application( i read in pushdemo application). When i try to access this link

 

https://pushapi.eval.blackberry.com/mss/PD_subReg?serviceid=xxxx&osversion=yyyy&model=zzzz

 

i got return 200 result, after that i want to open port

ServerSocketConnection socket = (ServerSocketConnection) Connector.open( "http://:myport");

socket.acceptAndOpen();

 

so how can i get successful with acceptAndOpen()    

 

Thanks .               

Please use plain text.
Developer
peter_strange
Posts: 17,958
Registered: ‎07-14-2008

Re: ServerSocketConnection problem with acceptAndOpen()?

Sorry never look at BIS push myself.  However as a learning exercise, have you looked at the httppushdemo included in your SDK.  As far as I know, it effectively does the same client processing as when you use BIS push, but you can control it from your PC.  A good place to start.  I would recommend that you give it a go. 

Please use plain text.
Contributor
tramntn
Posts: 39
Registered: ‎04-20-2010
My Carrier: Developer

Re: ServerSocketConnection problem with acceptAndOpen()?

thank you for you answer, i have look at httppushdemo i follow step by step in readme.txt file. but i cant receive anything on screen. i try with Rim option i got result

 

java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:8080/push?DESTINATION=2100000A&PORT=100&REQUESTURI=localhost

 

and try with Pap nothing happen.

 

i try to debug it stuck at link  stream = _notify.acceptAndOpen(); also

 

any idea?

 

thanks

Please use plain text.
Administrator
MSohm
Posts: 13,066
Registered: ‎07-09-2008
My Carrier: Bell

Re: ServerSocketConnection problem with acceptAndOpen()?

Is the MDS-CS Simulator running when you attempt the push?  Are you able to browse with the BlackBerry Browser?  Do you see activity in the MDS-CS Simulator window when you attempt the push?

 

It sounds like you may have another web server running on your PC using port 8080.  That means the MDS-CS Simulator is unable to listen on that port and accept your push connection.  The 400 response would be coming from the other web server.  You can change the port the MDS-CS Simulator is listening on by modifying the WebServer.listen.port parameter in the rimpublic.property file.  If you are using Eclipse, this is found in the following directory:

 

Eclipse 3.5.1\plugins\net.rim.ejde.componentpack#.#.#_#.#.#.##\components\MDS\config

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.