Unable to download the large files using pysftp

Issue - Unable to download the large files using pysftp

I am trying to put the file from local to target sftp using pysftp.
I have a file >500 MB to download using sftp connection.
I tried the following pysftp code and getting Error: <class ‘socket.error’>. Socket is closed

with pysftp.Connection(dest_host, port=dest_port,
username=abcd,
private_key=target_key_path, private_key_pass=12345,
cnopts=cnopts) as target_sftp
target_sftp.put(local_file)

However, the same code is able to download the file that has below 18mb size.

Here’s how you can upload files on our lab from your local machine:

https://cloudxlab.com/faq/20/how-should-i-upload-files-from-my-local-machine-to-cloudxlab