btashton edited a comment on issue #1639: URL: https://github.com/apache/incubator-nuttx/issues/1639#issuecomment-682167662
> All sockets support connection, even connection-less sockets like UDP. When you connect a UDP socket it just remembers the peer address so that you can use recv() instead of recvfrom(). with BTPROTO_HCI there is no concept of `accept`, `connect`, `listen`, or you can only issue a `bind` This is because this socket is for controlling local hardware there is no remote. You can see that Linux also does this here: https://elixir.bootlin.com/linux/latest/source/net/bluetooth/hci_sock.c#L1999 I think I can come up with something that will work within the existing network infrastructure with the slight addition of the protocol attached to the socket to help with some of the upper layers of the stack. You can see an example of the User Channel in my PR for the sim, but here is an example of using the monitor channel ``` fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); memset(&addr, 0, sizeof(addr)); addr.hci_family = AF_BLUETOOTH; addr.hci_dev = HCI_DEV_NONE; addr.hci_channel = HCI_CHANNEL_MONITOR; bind(fd, (struct sockaddr *) &addr, sizeof(addr)); setsockopt(fd, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt)); while(1) { handle_msg(recvmsg(handle->fd, &msg, 0)) } ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
