windows-dscp-fix

fix setsockopt behavior for ToS/DSCP on Windows.


Keywords
windows, network, socket, development, tos, dscp, python
Install
pip install windows-dscp-fix==0.2.1

Documentation

Windows DSCP Fix Python Package

A Python package to fix setsockopt(..,IP_TOS,..) behavior on Windows.

Why

  • In the IPPROTO_IP socket options for setsockopt, IP_TOS is marked as "DO NOT USE", and Windows QoS2 subsystem takes over the admission.

  • ToS/DSCP value is still an important field for QoS guarantee in IEEE 802.11 network, according to RFC 8325. However, there is no existing convenient method to tune the value.

  • On Windows, only DSCP value is allowed to set except ECN bits and the Administrator permission is required (link). So, this functionality has to be maintained as a third-party module, which will not be accepted by mainline.

Usage

import socket
import windows_dscp_fix
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.IPPROTO_IP, socket.IP_TOS, 128) #NOTE: Administrator permission required