SUMMARY
Attempting to use two sockets for the purpose of segregating Quality Of Service (QOS) setup/notification functionality from the actual data transfer
functionality (with QOS applied on the transfer) is not supported.
Developers are advised to use the same socket for both QOS setup/notification and for data transfer. This recommendation applies to both User Datagram
Protocol (UDP) and Transfer Control Protocol (TCP) sockets opened with the QOS Service Provider (QOSSP).
Developers should avoid the following scenario:
- Create and bind a socket using the QOSSP.
- Set QOS on that socket using WSAAccept, WSAConnect, WSAIoctl(SIO_SET_QOS), or WSAJoinLeaf.
- Set the socket option SO_REUSEADDR on that socket.
- Create another socket and bind to the same local address as the first socket.
- Use one of the sockets for QOS setup/notification (that is, waiting for and handling FD_QOS notification) and use the other socket for data
transfer, with QOS applied to the transfer.
The problem with this scenario is that Winsock leaves undefined the behavior of these two sockets, which have the same local address. For example, it is not
defined which socket would receive data. In the above scenario, it does not matter which socket has QOS set.
A second scenario, which involves duplicating a QOS socket for use in another process, is also not supported. For additional information about this scenario,
please click the article number below to view the article in the Microsoft Knowledge Base:
216603 PRB: Socket Dup. Not Supported by QOS-Capable TCP & UDP Service
Instead of using one of the above two scenarios, developers are advised to design their applications to perform as follows:
- Open a socket with the QOSSP.
- Set QOS for the socket using WSAAccept, WSAConnect, WSAIoctl(SIO_SET_QOS), or WSAJoinLeaf.
- Send/receive data using that socket.
- Handle all QOS setup/notification using that socket.