sock.sendall() isn't the same as `sock.send(); sock.flush()`
sendall will look something like:
def sendall(sock, msg):
totalsent = 0
MSGLEN = len(msg)
while totalsent < MSGLEN:
sent = sock.send(msg[totalsent:])
if sent == 0:
raise RuntimeError("socket connection broken")
totalsent = totalsent + sent