dotnet-io-pipelines

Build network I/O pipelines with System.IO.Pipelines for protocol parsing and backpressure.

Updated Aug 16, 2025
One-click install
npx skills add https://github.com/dodyg/blue-nile-pds --skill dotnet-io-pipelines-dodyg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-io-pipelines
Source: https://github.com/dodyg/blue-nile-pds/tree/main/.agents/skills/dotnet-io-pipelines
Command: npx skills add https://github.com/dodyg/blue-nile-pds --skill dotnet-io-pipelines-dodyg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Traditional stream‑based network I/O forces developers to manually manage buffers, handle partial reads, and endure costly memory copies, leading to performance bottlenecks and complex code.

Core Features & Use Cases

  • PipeReader/PipeWriter patterns: Zero‑copy buffer handling with automatic pooling.
  • Backpressure management: Configurable pause/resume thresholds prevent memory overload.
  • Protocol parsers: Efficient binary and delimiter‑based parsing using ReadOnlySequence<byte>.
  • Kestrel integration: Direct access to transport pipes for custom TCP or HTTP protocols.
  • Use case: Build a high‑throughput chat server that parses length‑prefixed messages, applies backpressure, and writes responses without allocating intermediate buffers.

Quick Start

Use the dotnet-io-pipelines skill to read from a network stream with PipeReader and write responses with PipeWriter.

Frequently Asked Questions about dotnet-io-pipelines

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle partial reads and memory allocations in .NET network I/O?

System.IO.Pipelines solves partial reads and memory allocations in .NET network I/O by providing automatic buffer pooling and zero-copy handling. PipeReader manages memory automatically, eliminating manual buffer sizing and reducing allocations during continuous network streaming.

What is the best way to implement backpressure management for high-throughput .NET network streams?

Backpressure management for high-throughput .NET network streams is implemented using System.IO.Pipelines with configurable pause and resume thresholds. This mechanism prevents memory overload by automatically pausing the producer when buffers fill up and resuming when the consumer drains them.

How do I parse binary protocols efficiently in C# without allocating intermediate buffers?

Binary protocol parsing in C# without intermediate buffer allocations is achieved using ReadOnlySequence<byte> within System.IO.Pipelines. This sequence handles fragmented buffer data across multiple segments, enabling efficient delimiter-based and length-prefixed protocol parsing without copying bytes.

Can I use System.IO.Pipelines to build a custom transport for Kestrel?

System.IO.Pipelines can be used to build a custom transport for Kestrel by directly accessing its transport pipes. This integration allows developers to implement custom TCP or HTTP protocol handling with zero-copy buffer management and built-in backpressure control.

When should I use System.IO.Pipelines instead of traditional Stream-based network I/O?

System.IO.Pipelines should be used instead of traditional Stream-based network I/O when building high-performance applications facing bottlenecks from manual buffer management, partial reads, or costly memory copies. It is ideal for protocol parsing and high-throughput scenarios like chat servers.

How do I adapt an existing Stream to a PipeReader and PipeWriter in .NET?

Adapting an existing Stream to a PipeReader and PipeWriter in .NET requires using seamless Stream-to-Pipeline adapters. This allows you to read from a network stream with PipeReader and write responses with PipeWriter while gaining automatic buffer pooling benefits.