So. I fell down a rabbit hole last month. I was writing python to talk to a motion control platform using raw TCP messages. I was doing this on Windows (don’t ask). My initial prototyping worked just fine, but as soon as I went to integrate the work into a PyQt app is started to get constant WinError 10053 errors. So the Venn diagram of PyQt, Windows and TCP … yeah, that’s niche AF.

TLDR: Use non-blocking sockets

Let’s start with the causes that it is not:

There can be multiple reason behind this error:

  • Presence of anti-virus softwares.
  • Firewall blocking the ports.
  • Network Configuration.
  • Problem can be caused by CORS.
  • Due to enabling of HTTP keep-alive connections

https://stackoverflow.com/a/51697893

Windows is infuriatingly bad at logging (amongst many things)… so here is the journey I went thru to find and then solve the problem:

So it seems even c# can manifest the issue: https://stackoverflow.com/questions/14304658/c-sharp-an-established-connection-was-aborted-by-the-software-in-your-host-machi

Which led me to this: https://www.chilkatsoft.com/p/p_299.asp (yup, circa 2007)

So then the question becomes “how do you empty a socket in python” and this pops up https://stackoverflow.com/questions/1097974/how-to-empty-a-socket-in-python

And then i’m here: https://docs.python.org/3/howto/sockets.html#non-blocking-sockets

If you’re writing custom socket code on Windows and you get WinError 10053: IT HAS NOTHING TO DO WITH YOUR FIREWALL

Leave a comment