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
Contributor
Posts: 39
Registered: ‎04-20-2010
My Device: 9550,8190
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

Contributor
Posts: 39
Registered: ‎04-20-2010
My Device: 9550,8190
My Carrier: Developer

Re: ServerSocketConnection problem with acceptAndOpen()?

 no help Smiley Sad

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

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.

Highlighted
Contributor
Posts: 39
Registered: ‎04-20-2010
My Device: 9550,8190
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 .               

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

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. 

Contributor
Posts: 39
Registered: ‎04-20-2010
My Device: 9550,8190
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

BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
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.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker