[Open Source] An Integrated Socket Network Communication Framework with a Comprehensive Set of Communication Modules

Open SourceProcess Management
2026-06-28 04:53 4 次浏览 • 0 次下载 0KB
[Open Source] An Integrated Socket Network Communication Framework with a Comprehensive Set of Communication Modules

1. Project Overview

Image

TouchSocket is an integrated socket network communication framework for .NET (including C#, VB.Net, and F#). It includes a series of communication modules such as TCP, UDP, SSL, HTTP, WebSocket, RPC, JSON-RPC, WebAPI, and XML-RPC. It provides one-click solutions for TCP packet fragmentation and packet sticking issues, as well as UDP large-packet fragmentation and reassembly. Using protocol templates, you can quickly implement parsing for various data packet formats, including fixed headers, fixed lengths, and delimiter-based character ranges.

2. Open Source License

Licensed under Apache-2.0

3. Screenshots

Image

4. Feature Overview

Feature Overview

Image

TouchSocket Features at a Glance

Traditional IOCP vs. TouchSocket IOCP Mode

TouchSocket's IOCP implementation differs from traditional approaches. Taking Microsoft's official example as a reference, it allocates a block of memory using MemoryBuffer, divides it into equal sections, and assigns one section to each session for receiving data. After data is received, it copies the received data and processes the copied data. TouchSocket, however, retrieves an available memory block from the memory pool before each receive operation and uses it directly to receive data. Once the data arrives, the memory block is passed directly for processing, eliminating the need for copying. Although this is a relatively small design improvement, performance differs by a factor of 10 when transmitting 64 KB of data 100,000 times.

Data Processing Adapters

You have probably used other Socket products. TouchSocket also draws on the excellent design concepts of other products. The data processing adapter is one such example. However, unlike other implementations, TouchSocket's adapter functionality is more powerful, easier to use, and more flexible. It can not only parse data packets in advance but also parse data objects. Adapters can be replaced at any time, with changes taking effect immediately. For example, fixed-header processing can be used to preprocess data and resolve packet fragmentation and sticking issues. It can also directly parse HTTP and WebSocket data protocols.

Compatibility and Adaptability

TouchSocket provides multiple framework models and is fully compatible with all protocols based on TCP and UDP. For example, TcpService and TcpClient provide the same basic functionality as Socket, while improving framework robustness and concurrency. Connections and received data are exposed through events, making the framework more user-friendly.

5. Tech Stack

Supported Environments

  • .NET Framework 4.5 and later.

  • .NET 6.0 and later.

  • .NET Standard 2.0 and later.

Supported Frameworks

  • Console

  • WPF

  • Winform

  • Blazor Server

  • Xamarin

  • MAUI

  • Avalonia

  • Mono

  • Unity 3D (excluding WebGL)

  • Others (including all C#-based environments)

#1
资源直链https://gitee.com/RRQM_Home/TouchSocket
去下载
星河码客

发现和分享优质开源项目,传承互联网精神,为开发者服务。

关于本站

联系我们

微信/广告合作:ITcloub (备注星河码客)

免责声明:本站资源版权归原作者所有,仅供学习与交流。如有侵权,请通过「关于我们 - 侵权投诉」联系删除。

Powered by Nuxt · Deployed on Cloudflare