Ask HN: Best modern file transfer/synchronization protocol?
I'm looking to build something to transfer files between two devices on a network (one client and one server, both of which are under my control).
Obviously I could write something bespoke with raw TCP sockets, but rather than reinventing the wheel I'm curious about what existing options people recommend. I assume there are some better technologies than FTP nowadays?
Ideally some kind of built-in fault tolerance would be great, because my plan is to use this on a phone/in an environment where the connection could be interrupted.
Edit: just to clarify - this is something I want to build into an application I am writing, ideally with support across iOS (client), Windows, and mac (server).
One way transfer is all I need, and I mostly plan on photos/videos (so multiple files ~3-20MB in size).
Thanks!
58 comments
[ 4.6 ms ] story [ 128 ms ] threadlibrsync also does not include any network functions for talking to SSH or any other server. To access a remote filesystem, you need to provide your own code or make use of some other virtual filesystem layer.
Having this seems to be one of the primary requirements.
Even with that, librsync highlights that rsync is really a protocol rather than the CLI tool GP post referred to.
syncthing for continuous use.
e.g. BitTorrent for the multiple servers case.
the server could expose an smb or nfs share, the client could mount it, and then sync to that mount.
rsync over ssh also works, if you do not want to run smb/nfs.
this is also a cool tool https://rclone.org/
You can ease the eureka moment by remembering that each node is completely independent and decided what comes in, and suggests what goes out.
You can say that a folder is two way on a node and read only on another - and this is great because tout make decisions locally that allow you to build nice things.
The real issue is that you have to check on both sides of the pipe what is allowed.
It is very robust and good for LAN and remote sync (the traffic is outgoing to a relay server. Note that many of these relay servers are also TOR nudes so they can be flagged by your severity systems. You can always use your own)
Edit: I’ll leave it here just in case it is useful for others but it may or may not be embeddable into your app, especially on the phone.
take a look at https://tus.io/
it shines when you need to sprinkle your data over many "clouds"
A local instance of Syncthing can behave as a robust sync tool + inotify API for applications consuming the files: https://docs.syncthing.net/rest/events-get.html#get-rest-eve...
i believe there's an embeddable golang library, but if you want something easy to use on android check in on syncthing-fork which lets you define more granular sync conditions including "just turn on 5 minutes every hour" https://github.com/Catfriend1/syncthing-android
depends on if it's large or small files.
It allows you to sync between 2 machines (bi-directional) over TCP or SSH.
Note that TCP way is not encrypted, you may use wireguard as transport layer encryption for that purpose...
You can use an external application to copy if file size is larger than an arbitrary number. (Eg: use rsync for files > 1gb)
that said, i haven't managed to set it up for my android phone yet - it's not available in termux and i have NO idea where to start if i'd like to package it myself. probably has to be done by someone who knows ocaml, since termux' environment is so different from normal linux.
unless... maybe i should give proot a shot (chroot in termux, lets you run something closer to linux). but it's another layer of complexity on top of everything....
Do a 3 way sync with the s3 command line tool.
That way, you have a neat cloud backup as well. Wouldn't take any more than 20 minutes total to set up.
https://iroh.computer/
Iroh is what you’re looking for. You can embed into your code, and it handled wire encryption, verification, and NAT hole punching. All over QUIC.
scp, rsync, wormhole give me only 2-3 mb/s.
For the context, I'm trying to transfer about 50-70 GB files.
What's causing the bottleneck here and what am I missing? Thanks in advance!
https://github.com/magic-wormhole/magic-wormhole
If speed test result is much faster, the bottleneck could be the CPU incapable of encrypting/decrypting data fast enough using the default encryption method used by SCP/rsync. In that case, try unencrypted file transfer instead. Maybe just serve the file temporarily with `python -m http.server`
- there is a max speed limit rule added to your access point to limit download/upload speed on one of your laptop. Remove them if you have access to the access point control panel, or use another access point
- the access point is overloaded, too many clients connected and its cpu can't keep up. Use another access point
- you are using 2.4Ghz band and it has a lot of interference in your area, try switching to 5Ghz or 6Ghz band if possible
- use adhoc transfer, directly connect to the other machine without using an access point: https://help.gnome.org/users/gnome-help/stable/net-wireless-...
(Sorry for replying late, I forgot to check back for replies)
--
3. self hosted ipfs in tailscale or something? (that would be cool)