-
Rust-based sender and receiver for efficient file transfers using serial ports. Handles errors such as
- when the sender transmits data before the receiver starts,
- or when the serial port is already in use.
-
Designed for continuous operation, the sender and receiver can run indefinitely, allowing users to simply copy files into a designated directory for transfer.
Tip
Ideal for secure environments where internet access is restricted/closed to protect systems.
- Rust-based implementation.
- Supports sending and receiving any type of file.
- Cross-platform compatibility.
- Rquires
Rust
for building both the sender and receiver components. serialport
crate for the sender,mio-serial
crate for the receiver,docker
andcross-rs
for cross-compiling.
- Rust: Install Rust via
rustup
by running:After installation, check:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustc --version cargo --version
Note
docker and cross-rs are required only for cross-compiling.
-
Docker: Cross-compiling with
cross-rs
requires Docker to be installed and running. Install Docker from Docker's official site.Check:
docker --version
-
cross-rs: for cross compiling
cargo install cross --git https://github.com/cross-rs/cross
# This will generate an executable with the name sender/sender.exe
# in ./target/release folder based on the current OS.
git clone https://github.com/VikasShavi/SeriCom.git
cd SeriCom/sender
cargo build --release
# This will generate an executable with the name receiver/receiver.exe
# in ./target/release folder based on the current OS.
cd SeriCom/receiver
cargo build --release
Warning
Wont work if docker daemon is not running
-
For windows(x86-64)
cross build --target x86_64-pc-windows-gnu
-
For linux(x86-64 dynamically linked)
cross build --target x86_64-unknown-linux-gnu
-
For linux(x86-64 statically linked)
cross build --target x86_64-unknown-linux-musl
Note
- Always start the receiver first
- Get the port name from
- Windows:
Device Manager --> Ports(COM & LPT)
- Linux:
ls /dev/tty.*
- Windows:
-
Windows
Receiver
.\receiver.exe <PORT> <BAUD_RATE> -- Example .\receiver.exe COM3 230400
Sender
.\sender.exe <PORT> <BAUD_RATE> <SLEEP_TIME_IN_SEC> <FOLDER_LOCATION:ALL_FILES_FROM_A_FOLDER_TO_SEND> -- Example .\sender.exe COM5 230400 5 c:\windows\temp
-
Linux
Receiver
./receiver <PORT> <BAUD_RATE> -- Example ./receiver /dev/tty.usbserial-110 230400
Sender
./sender <PORT> <BAUD_RATE> <SLEEP_TIME_IN_SEC> <FOLDER_LOCATION:ALL_FILES_FROM_A_FOLDER_TO_SEND> -- Example ./sender /dev/tty.usbserial-130 230400 5 /tmp
-
Example
demo.mp4
-
Serial Communication Libraries:
- Sending: The project uses the
serialport
crate for sending data over the serial connection. - Receiving: For receiving data, the
mio-serial
crate is used instead ofserialport
due to baud rate mismatch between the two ends of the serial cable.
- Sending: The project uses the
-
Reason for Choosing
mio-serial
for Receiving During testing, I encountered a speed issue when attempting to useserialport
for both sending and receiving. The two ends of the serial cable supported different baud rates, causing asynchronous communication problems when usingserialport
for receiving. Themio-serial
crate, which offers better handling of asynchronous IO, was chosen to address this mismatch and ensure stable communication across devices with varying baud rate support.
- Files are not received by the receiver: This can happen if any of the serial ports are ==Transmit-Only or Receive-Only Devices==. So just interchange the ports for the tools, then run and check once again.
Thank you for considering contributing to this project! Contributions, whether they be bug fixes, feature improvements, or new ideas, are welcome.
- Fork the repository: Click the "Fork" button at the top right of this repository to create a personal copy.
- Clone the repository: Clone your fork locally with:
git clone https://github.com/VikasShavi/SeriCom.git
- Create a new branch: Always work on a new branch to keep your changes isolated.
git checkout -b feature-or-bugfix-name
- Commit your changes: Keep your commits small and clear. Write descriptive commit messages:
git commit -m "Add feature/fix bug for..."
- Push your branch:
git push origin feature-or-bugfix-name
- Create a pull request (PR): Open a pull request from your branch to the main repository. Add a clear description of what changes were made and why.
- GPLv3
- Email: vikasvivek2000@gmail.com