4

How to create and join a socket to a socket group is explain here (WSASocket documentation).

http://msdn.microsoft.com/en-us/library/windows/desktop/ms742212(v=vs.85).aspx

It's also explained that all sockets in a socket group must connect to the same host endpoint using the same protocol. However, I don't understand when or why I would ever want to do this? Are there any particular benefits to this? And is this feature useful only to client applications (like a web browser), or is it something I could leverage in a server too?

Tim Lovell-Smith
  • 15,310
  • 14
  • 76
  • 93

1 Answers1

1

What you describe is only true for constrained groups. Unconstrained groups can contain sockets of different types/protocols.

If you look further down the documentation, it explains what socket groups actually are used for: "indicate to an underlying service provider a particular set of sockets are related and that the group thus formed has certain attributes. Group attributes include relative priorities of the individual sockets within the group and a group quality of service specification".

There are other documentation on MSDN that mention socket groups:

Socket Groups in the Windows Sockets 2 SPI

All use of socket groups is reserved.

WSAJoinLeaf function

lpGQOS [in] Reserved for future use with socket groups. A pointer to the FLOWSPEC structures for the socket group (if applicable).

WSAAccept function

lpfnCondition [in] The address of an optional, application-specified condition function that will make an accept/reject decision based on the caller information passed in as parameters, and optionally create or join a socket group by assigning an appropriate value to the result parameter g of this function.

...

The lpGQOS parameter is reserved, and should be NULL. (reserved for future use with socket groups) references the FLOWSPEC structure for the socket group the caller is to create, one for each direction, followed by any additional provider-specific parameters. A NULL value for lpGQOS indicates no caller-specified group quality of service. Quality of service information can be returned if negotiation is to occur.

Unless you are actually dealing with QOS in your code, then socket groups are not generally used.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770