Skip to contentSkip to conversation

Problem to really close RFComm socket

Bluez-devel Frederic Danis 2 participants 2 messages Apr 8, 2005 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hello,

I am trying to use RFComm sockets, but I have a problem when I close the socket, it does not close RFComm or ACL connection. So, if I try to reconnect I got an error 0x10. I used hcidump and nothing happens when close is called. The only way to really close is to stop the app.

what I use is :

       laddr.rc_family = AF_BLUETOOTH;
       laddr.rc_bdaddr = *BDADDR_ANY;
       laddr.rc_channel = 0;
      
       if (bind(rfcSocket, (struct sockaddr *)&laddr, sizeof(laddr)) < 0)
           return -1;
     
       raddr.rc_family = AF_BLUETOOTH;
       raddr.rc_bdaddr = SESSION(btAddr);
       raddr.rc_channel = channel;
       if (connect(rfcSocket, (struct sockaddr *)&raddr, sizeof(raddr)) 
< 0)
           return -1;

      ........

      close(rfcSocket);

I think I have forgot something, but what ?

Regards
Fred

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#1 lore raw

Hi Frederic,

Quoted 5 lines

I am trying to use RFComm sockets, but I have a problem when I close the socket, it does not close RFComm or ACL connection.
So, if I try to reconnect I got an error 0x10. I used hcidump and nothing happens when close is called.
The only way to really close is to stop the app.

are you using fork() in between?

The close() will close the DLC and if all DLCs are closed it will close the session. If no other session is active the underlaying ACL link will be terminated.

Regards

Marcel

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel