You'll typically see WSA_QOS_ESERVICETYPE (0x2B08) when a legacy Winsock application tries to set up a QoS (Quality of Service) connection, but the service type in the FLOWSPEC structure isn't one the Windows QoS provider understands. This often shows up after a Windows 10 or 11 update, when older software that used the now-deprecated QOS_STANDARD or SERVICE_BESTEFFORT flags suddenly fails with WSAGetLastError() returning 11016. The exact scenario I've seen in the field: a financial trading app written in the late 2000s, using WSAConnect with a hardcoded ServiceType value that Windows 11 22H2 no longer accepts.
Root Cause
The FLOWSPEC structure has a ServiceType field that tells Windows what kind of network traffic you're sending. Windows only accepts a small set of predefined service types, like SERVICE_BESTEFFORT (1), SERVICE_CONTROLLEDLOAD (5), and SERVICE_GUARANTEED (6). If your app passes anything else — a made-up number, a bitwise OR of valid values, or a value from an older SDK that's been deprecated — the QoS provider returns WSA_QOS_ESERVICETYPE.
Most of the time, this isn't a network problem. It's a code problem. Either the application has a bug, or it's linking against an old version of ws2_32.lib that uses different constants. Also, some third-party libraries that wrap Winsock QoS are sloppy about initializing the FLOWSPEC structure, leaving garbage in the ServiceType field.
How to Fix It
Here's a step-by-step approach that resolves 95% of cases. Start with the simplest and work your way down.
- Check the error code. Run your app and note the exact error. If it's 11016 (0x2B08), you're in the right place. Use a small test program to confirm that the service type is being set incorrectly. If you can't modify the app, skip to step 7.
- Open your source code. Find where you call
WSAConnect,WSAJoinLeaf, orsetsockoptwithSO_QOS. Look for aFLOWSPECorQOSstructure. - Verify the ServiceType value. In the
FLOWSPEC, make sureServiceTypeis one of these:
If you see anything else, change it toSERVICE_BESTEFFORT = 0x00000001 SERVICE_CONTROLLEDLOAD = 0x00000005 SERVICE_GUARANTEED = 0x00000006SERVICE_BESTEFFORTunless you genuinely need guaranteed bandwidth. Most apps don't. - Initialize the entire structure. If you're not zeroing out the
FLOWSPECbefore setting fields, you might have random bytes inServiceType. Do this:
If you skipFLOWSPEC flowspec; memset(&flowspec, 0, sizeof(flowspec)); flowspec.ServiceType = SERVICE_BESTEFFORT; flowspec.TokenRate = 0; flowspec.TokenBucketSize = 0; flowspec.PeakBandwidth = 0; flowspec.Latency = 0; flowspec.DelayVariation = 0; flowspec.MaxSduSize = 0; flowspec.MinPolicedSize = 0;memset, theServiceTypefield can be anything. - Rebuild with the current SDK. If your code compiles fine but still fails, you might be using an outdated
winsock2.h. Include the one from Windows 10/11 SDK. Usually, changing#include <winsock.h>to#include <winsock2.h>fixes it. - If it's a third-party library, wrap it. You can't change the library's internals, but you can intercept the call. Use a detour or hook to override the
ServiceTypetoSERVICE_BESTEFFORTbefore the actual Winsock call. That's a bit advanced, so only do it if you're comfortable with API hooks. - If you can't recompile, set a registry workaround. For legacy apps that won't be updated, you can sometimes force QoS off. In
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Psched, create a DWORDNonBestEffortLimitand set it to 0. This doesn't directly fix the error, but it disables QoS enforcement on the system, which may let the app limp along. Reboot after changing the registry.
What to Check If It Still Fails
If you've done all that and the error persists, check three things:
- Is QoS even supported on your network adapter? Open Device Manager, find your NIC, and check the Advanced tab for "QoS Packet Scheduler" or "Flow Control." If it's disabled, enable it. Some virtual adapters (like VMware) don't support QoS at all, and the error is a red herring.
- Are you running in a container or VM? Windows containers don't support QoS the same way. If your app runs in a Docker container, you may need to use host networking or drop QoS calls entirely.
- Is the service type a valid constant but still failing? If you set
ServiceType = SERVICE_GUARANTEEDand it still fails, the issue might be that the underlying network can't guarantee bandwidth. Switch toSERVICE_BESTEFFORTand let the system handle it. Guaranteed service is rarely implemented correctly anyway.
In my experience, the memset fix solves most cases. The rest are old apps that need a compatibility shim. Don't let this error make you think your network is broken — it's a software issue, and you can fix it with the steps above.