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

Native Development

Reply
Trusted Contributor
JohnWS
Posts: 117
Registered: ‎02-08-2013
My Device: 9900
My Carrier: verizon

bt_spp_open_server problem

I have struggling for hours but still can't solve this problem.

 

I accept a connection on my bt server through the callback, do some processing with the socket and then release resources. 

 

My problem is that I cannot reconnect to the bt server again unless I call bt_spp_open_server  again. Is this correct - do I have to recreate the server again after each connection is finished with?

 

Sometimes, even after calling bt_spp_open_server again it fails to open the server again even though I have called bt_spp_close_server.

 

I create a thread to send/receive data to bt client as advised in docs.

 

Thanks

 

 

Please use plain text.
Trusted Contributor
JohnWS
Posts: 117
Registered: ‎02-08-2013
My Device: 9900
My Carrier: verizon

Re: bt_spp_open_server problem

Has anyone used bt_spp_open_server before?

 

Do I have to restart the server after each connection? Do I close int fd once I am finished with it?

 

I have tried everything but still cant reconnect to the bt server unless I close the server and then reopen it but then even reopening the server fails sometimes after closing it.

 

At a loss but I really need a consistent bluetooth server.

Please use plain text.
Contributor
davidadams22
Posts: 12
Registered: ‎08-12-2013
My Device: Z10
My Carrier: Vodafone

Re: bt_spp_open_server problem

Is this a stupid question or something - should I be able to reconnect to a bt server without closing and reopening the bt server? If yes (that's my experience with servers) then why would I not receive a callback when I attempt to connect again?
Please use plain text.
BlackBerry Development Advisor (Retired)
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10
My Carrier: Bell Canada

Re: bt_spp_open_server problem

Hi,

 

You should close the server if you want to use it again.

 

Check out the sample written by the bluetooth dev team;

 

https://github.com/blackberry/Cascades-Samples/tree/master/bluetoothsppchat

 

Thanks!

--
Rob is no longer associated with BlackBerry.
Please use plain text.
Trusted Contributor
JohnWS
Posts: 117
Registered: ‎02-08-2013
My Device: 9900
My Carrier: verizon

Re: bt_spp_open_server problem

I appreciate the clarification.

 

thanks.

Please use plain text.