Skip to main content
ironrdp-blocking provides blocking I/O abstractions that wrap IronRDP state machines, offering a simpler synchronous API for RDP connections when concurrency is not required.

Overview

This crate is a higher-level abstraction for IronRDP state machines using blocking I/O instead of asynchronous I/O. It’s ideal when:
  • Concurrency is not a requirement
  • You prefer simpler synchronous code
  • You want fewer dependencies than async alternatives
  • You’re working in environments without async runtime support

Core Components

Framed

The Framed<S> type wraps any stream implementing std::io::Read and std::io::Write, providing buffered RDP protocol frame reading and writing.

Reading Frames

The framed wrapper provides several methods for reading RDP protocol frames: Read Exact Bytes Accumulates and returns exactly the specified number of bytes:
Read PDU Frames Reads a complete RDP PDU frame, automatically detecting the frame size:
Read by Hint Reads frames using a PDU hint that knows how to find frame boundaries:

Writing Frames

Write complete buffers to the underlying stream:

Accessing the Stream

You can access the underlying stream and buffered data:

Connection Sequence

The crate provides functions to drive the RDP connection sequence using blocking I/O.

Basic Connection Flow

Skipping Initial Phase

If the stream is already at the security upgrade phase:

Single Sequence Step

For manual control over the connection sequence:
This function:
  1. Reads the next PDU if the connector expects input
  2. Steps the connector state machine forward
  3. Writes any response to the stream

Relationship to Core State Machines

ironrdp-blocking wraps the core state machines from ironrdp-connector:
  • State machines (ironrdp-connector::ClientConnector) handle protocol logic
  • Blocking I/O layer (this crate) handles synchronous network communication
  • Framed wrapper manages buffering and frame boundary detection
The blocking layer calls into the state machines at each step, reading and writing frames as needed, but does so synchronously without async/await.

Error Handling

Most operations return std::io::Result<T> or ironrdp_connector::ConnectorResult<T>. Common error scenarios:
  • UnexpectedEof: Connection closed before receiving expected data
  • Frame parsing errors: Malformed RDP frames
  • Protocol errors: Connection sequence violations

When to Use

Use ironrdp-blocking when:
  • You’re building a simple RDP client without concurrency needs
  • You’re working in embedded environments without async support
  • You prefer straightforward blocking I/O patterns
  • You’re prototyping and want minimal complexity
For concurrent connections or high-performance scenarios, consider ironrdp-async with ironrdp-tokio or ironrdp-futures instead.

Dependencies

  • ironrdp-connector: Connection state machines
  • ironrdp-core: Core RDP types and utilities
  • ironrdp-pdu: PDU encoding and decoding
  • bytes: Efficient byte buffer management
  • tracing: Structured logging