I'm using Python 3 but assume Python 2 would work similarly
I want to have a python TCP socket receive exactly x_bytes.
msg = sock.recv(x_bytes)
This returns no more than x_bytes but may return less.
https://stackoverflow.com/a/1830689/10534730 suggests to use recv(x_bytes, socket.MSG_WAITALL)
but notes that it only seems to work on Unix. I am on Windows.