Skip to main content
IronRDP includes several example programs demonstrating different use cases and implementation patterns. These examples are located in 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-blocking crate
  • Shows TLS upgrade process with custom certificate verification
  • Handles graphics updates and image decoding
  • Supports compression configuration
Use Cases:
  • Automated screenshot capture for monitoring
  • Testing RDP server implementations
  • Learning basic IronRDP client structure
See detailed guide →

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
Use Cases:
  • Building custom RDP servers
  • Remote application access
  • Virtual desktop infrastructure (VDI)
  • Testing RDP client implementations
See detailed guide →

Example Structure

All examples follow a similar structure:
  1. Argument Parsing: Using pico_args for simple CLI argument handling
  2. Logging Setup: Tracing subscriber with IRONRDP_LOG environment variable
  3. Configuration: Building connector or server configuration
  4. Connection/Accept: Establishing the RDP connection
  5. Active Stage: Processing RDP protocol messages
  6. Cleanup: Proper resource cleanup and error handling

Common Patterns

Error Handling

All examples use anyhow::Result for convenient error handling:

Logging Configuration

Examples use the IRONRDP_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

Additional Resources