Skip to content

kcexn/tftp

Repository files navigation

TFTP client

Tests Codacy Badge Codacy Badge

A modern TFTP (Trivial File Transfer Protocol) client. Implements RFC 1350. This is the client counterpart to my TFTP server.

Features

  • Sender/Receivers implementation using asynchronous senders/receivers pattern.
  • RFC 1350 compliant TFTP protocol support
  • Command-line interface for file transfers

Building

Requires CMake 3.28+ and a C++20 compiler.

# Configure debug build
cmake --preset debug

# Build
cmake --build --preset debug

# Run tests
ctest --preset debug --output-on-failure

# Build optimized release
cmake --preset release
cmake --build --preset release

Installing

The default installation prefix is /usr/local. To install into a different location, you can set the CMAKE_INSTALL_PREFIX when configuring the build.

# Configure a release build.
cmake --preset release

# Configure a release build with a custom install prefix (default: /usr/local/).
cmake --preset release -D CMAKE_INSTALL_PREFIX=~/.local

# Build the release version.
cmake --build --preset release

# Install into the configured target.
# This may require root privileges (e.g. `sudo`) if installing to a system directory.
cmake --install build/release

Uninstalling

# The install manifest is created in the build directory,
# we can use it to remove all installed files.
xargs rm < build/release/install_manifest.txt

Usage

# Download a file from TFTP server
tftp -H hostname[:port] get <remote> <local>

# Upload a file to TFTP server
tftp -H hostname[:port] put <local> <remote>

Options

  • -h, --help - Display help message
  • -H, --host=<host[:port]> - TFTP server hostname:port (required, default port: 69)
  • --mode=<netascii|octet> - Transfer mode (default: octet)

Examples

# Download with default port (69)
tftp -H localhost get /tmp/remote.txt ./local.txt

# Upload with custom port
tftp -H localhost:6969 put ./file.txt /tmp/file.txt

# Download using netascii mode
tftp -H example.com --mode=netascii get /path/to/file.txt download.txt

License

GNU General Public License v3.0 or later. See LICENSE for details.

About

A simple tftp client.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published