crates/ironrdp/examples/ and showcase both client and server implementations.
Available Examples
Screenshot Example
File:crates/ironrdp/examples/screenshot.rs
A blocking, synchronous RDP client that connects to a server, captures the remote desktop display, and saves it as a PNG image file.
Features:
- Demonstrates basic RDP client implementation in under 500 lines
- Uses blocking I/O with
ironrdp-blockingcrate - Shows TLS upgrade process with custom certificate verification
- Handles graphics updates and image decoding
- Supports compression configuration
- Automated screenshot capture for monitoring
- Testing RDP server implementations
- Learning basic IronRDP client structure
Server Example
File:crates/ironrdp/examples/server.rs
A complete RDP server implementation using the ironrdp-server crate with support for audio output and clipboard redirection.
Features:
- Demonstrates RDP server implementation using
ironrdp-server - Implements audio streaming with OPUS encoding
- Supports clipboard redirection (stub implementation)
- Shows TLS/Hybrid security configuration
- Generates random colored bitmap updates for display
- Handles keyboard and mouse input events
- Building custom RDP servers
- Remote application access
- Virtual desktop infrastructure (VDI)
- Testing RDP client implementations
Example Structure
All examples follow a similar structure:- Argument Parsing: Using
pico_argsfor simple CLI argument handling - Logging Setup: Tracing subscriber with
IRONRDP_LOGenvironment variable - Configuration: Building connector or server configuration
- Connection/Accept: Establishing the RDP connection
- Active Stage: Processing RDP protocol messages
- Cleanup: Proper resource cleanup and error handling
Common Patterns
Error Handling
All examples useanyhow::Result for convenient error handling:
Logging Configuration
Examples use theIRONRDP_LOG environment variable for log filtering:
TLS Configuration
Custom certificate verification for testing:Building Examples
Build All Examples
Build Specific Example
Run with Logging
Platform Support
Examples are cross-platform and detect the current platform for reporting:Dependencies
Common dependencies across examples:- ironrdp: Core RDP protocol implementation
- ironrdp-blocking: Blocking I/O abstractions
- anyhow: Error handling
- tokio-rustls: TLS support
- tracing: Structured logging
- pico_args: Argument parsing
- image: Image encoding (screenshot example)
- rand: Random number generation (server example)
Next Steps
Screenshot Example
Learn how to build a simple RDP client that captures screenshots
Server Example
Build a complete RDP server with audio and clipboard support

