How to set DSCP in IP header for UDP socket in Windows

187 Views Asked by At

On my receiving device, it needs to have the DCSP field set to 0xff in order to properly receive and deal with incoming UDP packets. On Linux, I can set IPPROTO_IP, IP_TOS, and everything works as expected (it being set in the header). But not so with Windows.

I tried configuring SIO_SET_QOS with the line int r = WSAIoctl( nSocket, SIO_SET_QOS, &QoS, sizeof( QoS ), 0, 0, 0, 0, 0 ); where QoS is a object of type QOS and is initialized. But it would only return -1, indicating it was not setting the service. Also, even if this did work, I don't know how I would set the DCSP to 0xff, instead of letting Windows decide its service descriptor.

I saw references to IP_DSCP_TRAFFIC_TYPE but I can't seem to figure out what it is, or its #define type, and it appears to be EOL'd.

What can I do to set the Differentiated Services Code Point field in the IP header?

0

There are 0 best solutions below