Skip to main content
ironrdp-tokio provides Tokio runtime integration for IronRDP, implementing the framing traits from ironrdp-async using Tokio’s async I/O primitives.

Overview

This crate bridges IronRDP’s async abstractions with the Tokio runtime by:
  • Implementing FramedRead and FramedWrite for Tokio streams
  • Providing specialized stream wrappers with different Send semantics
  • Offering optional HTTP client integration via reqwest

Quick Start

Stream Wrappers

The crate provides three stream wrapper types with different trait bounds:

TokioStream (Send + Sync)

For streams that are both Send and Sync, enabling use across threads:
Type bounds: S: Send + Sync + Unpin + AsyncRead/AsyncWrite

LocalTokioStream (Local)

For local (non-Send) streams like LocalSet tasks:
Type bounds: S: Unpin + AsyncRead/AsyncWrite (no Send requirement)

MovableTokioStream (Send)

For streams that are Send but not Sync:
Type bounds: S: Send + Unpin + AsyncRead/AsyncWrite

Splitting Streams

Split a framed stream into separate read and write halves:
Splitting is useful for:
  • Concurrent reading and writing
  • Separate read/write task responsibilities
  • Pipeline architectures

FramedRead Implementation

The TokioStream implements FramedRead using Tokio’s AsyncReadExt::read_buf:
This leverages Tokio’s optimized read_buf for zero-copy reading into BytesMut buffers.

FramedWrite Implementation

The TokioStream implements FramedWrite with automatic flushing:
The automatic flush ensures frames are sent immediately, which is important for RDP’s request-response patterns.

HTTP Client Integration

With the reqwest feature, get an HTTP client for network authentication:

Features

  • reqwest: Enables reqwest-based HTTP client (base feature)
  • reqwest-rustls-ring: Use rustls with ring crypto for TLS
  • reqwest-native-tls: Use native platform TLS
Select one TLS backend:

Complete Connection Example

Performance Considerations

Tokio integration provides excellent performance:
  • Zero-copy reads: read_buf writes directly into BytesMut
  • Efficient buffering: Minimal allocations via bytes crate
  • Optimal scheduling: Tokio’s work-stealing scheduler handles multiple connections efficiently

When to Use

Use ironrdp-tokio when:
  • Building with the Tokio ecosystem
  • Need high-performance async I/O
  • Want integration with Tokio libraries (hyper, tonic, etc.)
  • Require concurrent connection handling
For other runtimes, use ironrdp-futures instead. For blocking I/O, use ironrdp-blocking.

Dependencies

  • ironrdp-async: Core async abstractions (re-exported)
  • tokio: Async runtime (with io-util features)
  • bytes: Efficient byte buffers
  • reqwest (optional): HTTP client for network auth
  • sspi (optional): Windows authentication
  • url (optional): URL parsing

Re-exports

This crate re-exports all of ironrdp-async:
You can use all async traits, types, and functions directly from ironrdp_tokio.