Handle partial reads when reading from the sockets.