ColorVision.SocketProtocol 1.3.8.3

dotnet add package ColorVision.SocketProtocol --version 1.3.8.3
                    
NuGet\Install-Package ColorVision.SocketProtocol -Version 1.3.8.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ColorVision.SocketProtocol" Version="1.3.8.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ColorVision.SocketProtocol" Version="1.3.8.3" />
                    
Directory.Packages.props
<PackageReference Include="ColorVision.SocketProtocol" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ColorVision.SocketProtocol --version 1.3.8.3
                    
#r "nuget: ColorVision.SocketProtocol, 1.3.8.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ColorVision.SocketProtocol@1.3.8.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ColorVision.SocketProtocol&version=1.3.8.3
                    
Install as a Cake Addin
#tool nuget:?package=ColorVision.SocketProtocol&version=1.3.8.3
                    
Install as a Cake Tool

ColorVision.SocketProtocol

🎯 功能定位

网络通信协议模块,提供Socket和串口通信功能。

作用范围

通信协议层,为设备通信提供统一的网络接口。

主要功能点

  • Socket通信 - TCP/UDP网络通信协议
  • 串口通信 - RS232/RS485串口设备通信
  • 协议封装 - 统一的通信协议接口
  • 连接管理 - 自动重连和连接状态监控
  • 数据缓冲 - 高效的数据收发缓冲机制
  • 异步通信 - 支持异步通信避免界面阻塞

与主程序的依赖关系

被引用方式:

  • ColorVision.Engine 引用用于设备通信
  • 各插件和项目引用用于外部通信

引用的程序集:

  • System.IO.Ports - 串口通信
  • System.Net.Sockets - Socket通信

使用方式

引用方式

<ProjectReference Include="..\ColorVision.SocketProtocol\ColorVision.SocketProtocol.csproj" />

在主程序中的启用

  • 通过设备配置自动启用对应通信方式
  • 支持插件化通信协议扩展

开发调试

dotnet build UI/ColorVision.SocketProtocol/ColorVision.SocketProtocol.csproj

通信示例

Socket通信示例

// 创建TCP客户端
var client = new SocketClient("192.168.1.100", 8080);

// 连接服务器
await client.ConnectAsync();

// 发送数据
await client.SendAsync(data);

// 接收数据
var response = await client.ReceiveAsync();

串口通信示例

// 配置串口
var serialPort = new SerialPortClient
{
    PortName = "COM3",
    BaudRate = 9600,
    DataBits = 8,
    Parity = Parity.None,
    StopBits = StopBits.One
};

// 打开串口
serialPort.Open();

// 发送数据
serialPort.Write(data);

// 接收数据
var response = serialPort.Read();

相关文档链接

维护者

ColorVision 通信团队

Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed.  net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.8.3 139 9/30/2025
1.3.8.2 158 9/29/2025
1.3.8.1 156 9/25/2025
1.3.6.1 152 9/5/2025
1.3.5.2 178 9/3/2025
1.3.5.1 236 8/24/2025
1.3.3.1 159 8/18/2025
1.3.2.4 168 7/15/2025
1.3.2.3 158 6/23/2025
1.3.2.2 178 6/3/2025
1.3.2.1 170 6/2/2025