Is it possible to set multiple bluetooth service for winsock2?

In Vista’s bluetooth stack, the rfcomm is handled using winsock2, and
the service is setting using WSASetService. However, if we set
multiple service for a socket, how could we know the service of the
incoming connection via accept?


This message was sent using IMP, the Internet Messaging Program.

Why would you set multiple services for the same socket? Each socket will have its own RFCOMM channel number in the SDP record so you would need a different socket per channel. Just create a socket per service and call WSASetService on each socket only once.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Ming-I Hsieh
Sent: Wednesday, January 23, 2008 5:46 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Is it possible to set multiple bluetooth service for winsock2?

In Vista’s bluetooth stack, the rfcomm is handled using winsock2, and
the service is setting using WSASetService. However, if we set
multiple service for a socket, how could we know the service of the
incoming connection via accept?


This message was sent using IMP, the Internet Messaging Program.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

less sockets -> less complexity. For example, if we set a service to
handle the rfcomm channels of handsfree/headset audio gateway/generic
audio, we must set

HandsfreeAudioGatewayService_UUID,
HeadsetAudioGatewayService_UUID,
HandsfreeService_UUID, and
HeadsetService_UUID

for 4 sockets. However, to handle 4 socket requires more code and more
resources. If it could be set as one socket and get the service from
getpeername, we could save some code and complexity.

However, why bluetooth’s socket api does not support overlapped io and
iocompletion?

Regards, Mihs

Quoting Doron Holan :

> Why would you set multiple services for the same socket? Each
> socket will have its own RFCOMM channel number in the SDP record so
> you would need a different socket per channel. Just create a socket
> per service and call WSASetService on each socket only once.
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Ming-I Hsieh
> Sent: Wednesday, January 23, 2008 5:46 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Is it possible to set multiple bluetooth service
> for winsock2?
>
> In Vista’s bluetooth stack, the rfcomm is handled using winsock2, and
> the service is setting using WSASetService. However, if we set
> multiple service for a socket, how could we know the service of the
> incoming connection via accept?
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

What parts of a Bluetooth socket do you think does not support async overlapped i/o? the underlying driver is completely async, as is the TDI layer above it. the winsock layer can support async i/o as wel. What apis are you using to send and receive data?

I don’t see how less sockets is less complexity here. In the end if a remote device connects you are going to get a new socket off of your listen() call for every connection, you would never get one socket for all rfcomm connections from the device. This means that you will have a socket each for HF audio, HS audio, HF, and HS connections, regardless of if you could have one socket listening.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Ming-I Hsieh
Sent: Wednesday, January 23, 2008 11:43 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Is it possible to set multiple bluetooth service for winsock2?

less sockets -> less complexity. For example, if we set a service to
handle the rfcomm channels of handsfree/headset audio gateway/generic
audio, we must set

HandsfreeAudioGatewayService_UUID,
HeadsetAudioGatewayService_UUID,
HandsfreeService_UUID, and
HeadsetService_UUID

for 4 sockets. However, to handle 4 socket requires more code and more
resources. If it could be set as one socket and get the service from
getpeername, we could save some code and complexity.

However, why bluetooth’s socket api does not support overlapped io and
iocompletion?

Regards, Mihs

Quoting Doron Holan :

> Why would you set multiple services for the same socket? Each
> socket will have its own RFCOMM channel number in the SDP record so
> you would need a different socket per channel. Just create a socket
> per service and call WSASetService on each socket only once.
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Ming-I Hsieh
> Sent: Wednesday, January 23, 2008 5:46 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Is it possible to set multiple bluetooth service
> for winsock2?
>
> In Vista’s bluetooth stack, the rfcomm is handled using winsock2, and
> the service is setting using WSASetService. However, if we set
> multiple service for a socket, how could we know the service of the
> incoming connection via accept?
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Quoting Doron Holan :

> What parts of a Bluetooth socket do you think does not support async
> overlapped i/o? the underlying driver is completely async, as is
> the TDI layer above it. the winsock layer can support async i/o as
> wel. What apis are you using to send and receive data?
AcceptEx. If a bluetooth socket is created with overlapped flags and
iocompletion, AcceptEx will return an error, 6 - ENXIO. This is why I
think Bluetooth socket does not support overlapped io. But the similar
code is working fine for TCP and UDP socket, or we must set something
for bluetooth socket?

>
> I don’t see how less sockets is less complexity here. In the end if
> a remote device connects you are going to get a new socket off of
> your listen() call for every connection, you would never get one
> socket for all rfcomm connections from the device. This means that
> you will have a socket each for HF audio, HS audio, HF, and HS
> connections, regardless of if you could have one socket listening.
of course, the state machine is most complexity part for such a
service. To set multiple service for a listen socket is only to reduce
the number of sockets while a thread support multiple service. Of
course, if IoCompletion is working fine for bluetooth socket, it’s not
kindly important. But if IoCompletion does not work, to reduce it
would be helpful to save some resources for others.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

Quoting Doron Holan :
> What parts of a Bluetooth socket do you think does not support async
> overlapped i/o? the underlying driver is completely async, as is
> the TDI layer above it. the winsock layer can support async i/o as
> wel. What apis are you using to send and receive data?
After checking it again, I am glad to know the bug is my wrong. While
I copied to old(working) code to new one, I forgot to initial the
member variable of OVERLAPPED. This is why I got an errcode 6. Thanks
for ur help.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.