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" />
<PackageReference Include="ColorVision.SocketProtocol" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=ColorVision.SocketProtocol&version=1.3.8.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 | Versions 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.
-
net6.0-windows7.0
- ColorVision.UI (>= 1.3.8.6)
- log4net (>= 3.2.0)
- Newtonsoft.Json (>= 13.0.4)
-
net8.0-windows7.0
- ColorVision.UI (>= 1.3.8.6)
- log4net (>= 3.2.0)
- Newtonsoft.Json (>= 13.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.