Skip to content

GecStudent/Employee-Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

streaming-sender (employee-agent)

A high-performance screen streaming sender written in Rust. The program captures the primary display, optionally compresses frames as JPEG, and streams them to a TCP receiver. It includes adaptive quality control, persistent configuration, auto-start on boot, and an auto-restart-on-crash mechanism.

This README documents the executable's CLI, configuration files, examples, and platform specifics found in the project's source.

Highlights

  • Cross-platform screen capture using the scrap crate (Windows + Unix).
  • JPEG compression via the image crate (configurable quality).
  • Adaptive quality adjustments based on measured FPS and connection issues.
  • Auto-start integration (Windows registry or Linux ~/.config/autostart).
  • Auto-restart on crash with configurable delay and retry limit.
  • Persists connection_config.json and startup_config.json next to the executable.

Quick start

  1. Install Rust and Cargo (if not already): https://rustup.rs

  2. Build (release):

cargo build --release
  1. Run (development):
cargo run -- <SERVER_IP> [PORT] [OPTIONS]
  1. Or run the release binary (Windows example):
.\target\release\streaming_sender.exe 192.168.1.100 7878 --fps 60 --quality 75

CLI / Usage

Positional arguments:

  • SERVER_IP (required on first run) — IP address of the receiver server.
  • PORT (optional) — TCP port (default: 7878).

Flags / options:

  • --fps Set target frames per second (1–120). Default: 60.
  • --quality JPEG quality percentage (10–100). Default: 75.
  • --no-compression Send raw frames (no JPEG compression).
  • --no-adaptive Disable adaptive quality adjustments.
  • --enable-startup Register the executable to auto-start on boot.
  • --disable-startup Remove auto-start registration.
  • --enable-restart Enable auto-restart on crash (writes to startup_config.json).
  • --disable-restart Disable auto-restart.
  • --status Print current startup/restart configuration.
  • --auto-restart Internal flag used when restarting automatically (do not use manually).

Notes about saved configuration

  • On first run the program expects SERVER_IP (and optionally PORT). After that it saves the connection into connection_config.json next to the executable and will use that saved config on subsequent runs.
  • Startup and restart preferences are stored in startup_config.json. The program will create defaults if the file is missing.

Config file formats

connection_config.json example:

{
  "ip": "192.168.1.100",
  "port": "7878"
}

startup_config.json example (defaults created by the app):

{
  "auto_startup_enabled": true,
  "auto_restart_enabled": true,
  "restart_delay_seconds": 5,
  "max_restart_attempts": 10
}

Behavior summary

  • If startup_config.json has auto_startup_enabled: true, the application will try to register itself for auto-start on first run.
  • If the app crashes and auto_restart_enabled is true, it will attempt to restart itself up to max_restart_attempts, waiting restart_delay_seconds between attempts.
  • Adaptive quality reduces JPEG quality when connection issues or low FPS are detected.

Examples

  • First-time setup (saves connection):
.\target\release\streaming_sender.exe 192.168.1.100 7878
  • High-quality 60 FPS stream:
.\target\release\streaming_sender.exe 192.168.1.100 7878 --fps 60 --quality 95
  • Low-bandwidth mode:
.\target\release\streaming_sender.exe 192.168.1.100 7878 --fps 15 --quality 50
  • Disable compression and adaptive quality:
.\target\release\streaming_sender.exe 192.168.1.100 7878 --no-compression --no-adaptive
  • Enable / disable auto-start or auto-restart:
.\target\release\streaming_sender.exe --enable-startup
.\target\release\streaming_sender.exe --disable-startup
.\target\release\streaming_sender.exe --enable-restart
.\target\release\streaming_sender.exe --disable-restart
.\target\release\streaming_sender.exe --status

Platform specifics

  • Windows

    • Auto-start is implemented by adding an entry to HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run using the winreg crate.
    • The binary contains #![windows_subsystem = "windows"] to prevent a console window when built as GUI; use the console build if you need console logging.
  • Linux / Unix

    • Auto-start is implemented by writing a .desktop file to $HOME/.config/autostart.

Dependencies

See Cargo.toml. Major crates used:

  • scrap — screen capture
  • image — jpeg encoding
  • serde / serde_json — config serialization
  • ctrlc — signal handling
  • winreg (Windows only) — registry manipulation

Troubleshooting

  • Cargo not found: install Rust via rustup (https://rustup.rs/) to get cargo.
  • Capture errors: verify display permissions and that the scrap crate supports your environment.
  • If connection_config.json is corrupted, delete it and re-run the program to recreate default config.

Security & notes

  • This sender streams raw frames (or JPEG-compressed frames) without encryption. If you plan to use this over untrusted networks, add transport-level encryption (TLS) or a VPN.
  • --auto-restart is used internally; do not rely on it as a user-facing flag.

Contributing

Issues and PRs are welcome. If adding new public CLI flags, update the README examples and add tests where appropriate.

License

No license file is included. Add a LICENSE file if you intend to publish under a specific open-source license.


If you'd like, I can additionally:

  • Extract and add the full help text (generated from source) into the README.
  • Add a short HOWTO showing how to build a matching receiver server.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages