SCP vs SFTP for data transfer over 4G cellular connection

0

I'm creating a program to transfer files from a remote computer to my server through a 4G cellular connection, and am looking for some input on whether I should use SCP or SFTP.

I've studied their differences, and I know that SCP is faster, especially over higher latency connections (which my connection will be relatively high). SCP is not capable of resuming transfers though if there is a connection problem, and needs to start over. SFTP has much better data corruption detection and can resume an interrupted transfer.

The files I will be transferring will be ~30MB in size, and I could be transferring anywhere from 1 to like 15 of them, so sufficient speed would be desirable. But due to the nature of a cellular connection, I'm not sure if SCP will work too well or not. Input would be greatly appreciated, thanks!

Ryan

Posted 2017-06-09T14:22:44.133

Reputation: 1

1rsync could be a better choice than either. – xenoid – 2017-06-09T14:35:17.080

Answers

6

Why not rsync?

It's fast, good on unreliable connections, checksums transfers, and full of features.

If your data is compressible and network is bottlenecking:

rsync -avzHXShPs user@remotehost:/remote/path/to/file /local/path/to/file

If your data isn't compressible or your network speed is faster than the compression, exclude the -z flag:

rsync -avHXShPs user@remotehost:/remote/path/to/file /local/path/to/file

If you are doing incremental updates to your destination:

rsync -avzHXhPs --inplace --no-whole-file user@remotehost:/remote/path/to/file /local/path/to/file

If you are paranoid about the destination's integrity:

rsync -avzcHXhPs --inplace --no-whole-file user@remotehost:/remote/path/to/file /local/path/to/file

Additional Resources

Deltik

Posted 2017-06-09T14:22:44.133

Reputation: 16 807