File Transfer Application

file-transfer

2026 · Solo project · C++20 on Linux, no GUI, no third-party libraries

A low-latency, peer-to-peer file transfer tool in modern C++20 for Linux. A sender streams a file of any size or format to a receiver over TCP using length-prefixed framing, moves the bytes with a sendfile(2) zero-copy path, proves each transfer byte-for-byte correct with a streaming XXH64 whole-file hash verified before an atomic commit, and can resume a transfer killed partway through. Built and verified end-to-end over loopback and clean under ThreadSanitizer.

The transfer core is a layered, unit-tested design — framing codec, streaming hash with known-answer vectors, path sanitization — exercised by an offline round-trip suite over every edge-case size, so correctness is provable without guessing.


Learning outcomes

  • Application-level framing over a TCP byte stream: length-prefixed frames, correct partial-I/O (recv/send/sendfile loops), explicit endianness.
  • Throughput toolkit: sendfile zero-copy, posix_fadvise, socket-buffer tuning, and a producer/consumer pipeline that overlaps network + disk + hash.
  • Data-integrity & crash-safety engineering: streaming checksums, atomic .part → fsync → rename commit, resume from a verified offset, and bounds-checking every frame length against a hostile peer.