I have tested on Mi Router 4c Firmware version 2.14.92 and the script worked flawlessly. I used MacOS buildin Python3 and netcat