KISS File Transfer Sender Documentation

The Sender is a core component of the file‑transfer suite. It takes one or more files and transmits them as a series of KISS‑framed packets. The Sender supports both file‑mode (sending a comma‑delimited list of files) and directory‑monitoring mode (watching a directory for new files to send). It features configurable window (burst) size, optional compression, and optional Base64 encoding of the payload. Additionally, it can read data from standard input when required.

Table of Contents

Overview

The Sender reads file data, optionally compresses it (compression is enabled by default), and – if requested – encodes the payload in Base64. It then splits the file data into chunks and constructs an initial header packet (which includes metadata such as the filename, original and compressed sizes, MD5 checksum, file ID, encoding method, and compression flag) followed by a series of data packets.

A sliding‐window (burst) protocol is implemented to allow multiple packets to be sent before waiting for cumulative ACKs. The window size can be set manually (choosing from 1, 2, 4, 6, 8, or 10) or allowed to adjust automatically by specifying "auto". In addition, the program can monitor a directory for new files (using fsnotify) instead of sending a fixed list of files. The Sender also supports reading data from standard input; when using standard input, a filename must be provided to populate the header metadata.

Installation & Build

To build the Sender, ensure you have Go installed along with the required packages (fsnotify and go.bug.st/serial). Then compile the program:

go build -o sender sender.go
  

Command‑Line Options

The table below details all available command‑line options along with descriptions and default values:

Flag Description Default Value
--my-callsign Your callsign (required). none
--receiver-callsign Receiver's callsign (required). none
--window-size Window (burst) size as an integer or the string "auto". Allowed values are 1, 2, 4, 6, 8, 10. When set to "auto" the sender adjusts the window dynamically. auto
--connection Connection type: tcp or serial. tcp
--debug Enable debug output. false
--host TCP host for the connection (used if --connection is tcp). 127.0.0.1
--port TCP port for the connection (used if --connection is tcp). 9001
--serial-port Serial port device (e.g. /dev/ttyUSB0 or COM3). Required when using a serial connection. empty
--baud Baud rate for the serial connection. 115200
--file Comma‑delimited list of files to send. (Mutually exclusive with --file-directory and --stdin.) empty
--file-directory Directory to monitor for files to send. (Mutually exclusive with --file and --stdin.) empty
--file-directory-retries Number of retries for sending a file from the directory. 0
--file-directory-existing When set to true, queue existing files in the monitored directory. false
--no-compress Disable compression. (By default, compression is enabled.) false
--timeout-seconds Timeout in seconds for waiting for ACKs (applied per burst). 10
--timeout-retries Number of timeout retries before giving up on a transfer. 5
--base64 When set to true, encode the file payload in Base64 (applied on each chunk after compression). false
--stdin Read file data from standard input instead of from a file or directory. (Mutually exclusive with --file and --file-directory.) false
--file-name Specifies the filename to be used in the header when reading data from standard input. This option is required when --stdin is set. none
--fileid Optional 2‑character alphanumeric file ID to identify the transfer. Only valid with --file or --stdin. If not provided, a random ID is generated. none

Examples

Example 1: Sending Files Over TCP

The following command sends a comma‑delimited list of files to a receiver at 127.0.0.1:9001. The sender’s callsign is N0CALL and the receiver’s callsign is W1AW. Window size is auto‑adjusted.

go run sender.go --my-callsign=N0CALL --receiver-callsign=W1AW --connection=tcp --host=127.0.0.1 --port=9001 --file="file1.txt,file2.txt"
  

Example 2: Sending Files Over Serial with Base64 Encoding

This command sends a file using a serial connection on /dev/ttyUSB0 at 115200 baud. The file payload will be compressed and then Base64‑encoded.

go run sender.go --my-callsign=N0CALL --receiver-callsign=W1AW --connection=serial --serial-port=/dev/ttyUSB0 --baud=115200 --file="document.pdf" --base64
  

Example 3: Directory Monitoring Mode

The following command monitors the directory /path/to/files for new files. Any new (or existing, if --file-directory-existing is set) file in that directory will be sent. The sender will retry sending a file 3 times before giving up.

go run sender.go --my-callsign=N0CALL --receiver-callsign=W1AW --connection=tcp --host=127.0.0.1 --port=9001 --file-directory="/path/to/files" --file-directory-retries=3 --file-directory-existing
  

Example 4: Using a Static Window Size and Disabling Compression

In this example, the sender uses a fixed window size of 6 packets and disables compression.

go run sender.go --my-callsign=N0CALL --receiver-callsign=W1AW --connection=tcp --host=127.0.0.1 --port=9001 --file="image.jpg" --window-size=6 --no-compress
  

Example 5: Reading Data from Standard Input

This example demonstrates how to pipe data into the sender using standard input. The --stdin flag tells the sender to read from standard input, and the --file-name flag specifies the filename that will appear in the header.

cat mydata.bin | go run sender.go --my-callsign=N0CALL --receiver-callsign=W1AW --connection=tcp --host=127.0.0.1 --port=9001 --stdin --file-name="mydata.bin"
  

Additional Notes

Contact & Support

For additional questions, issue reports, or support, please contact the project maintainer or visit the source repository.