Improve performance: use sendall