do not use socket.sendall

socket.sendall is not compatible with non blocking connections. Use
socket.send instead and manually slice the data frame as needed.