AsyncTcpEx 1.0.0.2
dotnet add package AsyncTcpEx --version 1.0.0.2
NuGet\Install-Package AsyncTcpEx -Version 1.0.0.2
<PackageReference Include="AsyncTcpEx" Version="1.0.0.2" />
paket add AsyncTcpEx --version 1.0.0.2
#r "nuget: AsyncTcpEx, 1.0.0.2"
// Install AsyncTcpEx as a Cake Addin #addin nuget:?package=AsyncTcpEx&version=1.0.0.2 // Install AsyncTcpEx as a Cake Tool #tool nuget:?package=AsyncTcpEx&version=1.0.0.2
AsyncTcp
异步TCP服务器、TCP客户端
支持自定义通信协议,可以作为简单的数据交换通信信道,如接口通信。如果想要传输大文件,需要实现自定义的通信协议,如果想要稳定,还需要支持断点续传。
刚开始引入TCP服务器功能时,觉得supersocket挺好用的,也支持自定义通信协议,但是使用了一段时间后发现自定义的数据过滤器经常丢失数据,实在搞不清楚他的数据过虑器该怎么实现,所以自己实现一个通信协议。
目前已实现的通信协议:
开始标志-数据-结束标志
开始标志:垂直制表符,一个字节
byte[] m_beginMark = new byte[] { (byte)((char)11) };
结束标记:文件分割符+回车符,两个字节
byte[] m_endMark = new byte[] { (byte)((char)28), (byte)((char)13) };
开始标志-数据长度-数据-校验码。
开始标志:垂直制表符,一个字节
byte[] m_beginMark = new byte[] { (byte)((char)11) };
数据长度:4个字节,包含整个消息结构长度:开始标志、数据长度、消息体、校验码构成的字节长度。
效验码:一个字节,这个版本的校验码只是简单的对消息体字节数组中每个字节“异或”操作后的结果,自定义的版本可以替换为任何想要的方法。
引用说明:
引用该库后也可以自定义自己的通信协议,继承IReceiveDataFilter即可,实现思路其实也是参考了supersocket的思路,只是搞不清楚他的数据过虑器该怎么实现。
具体实现可参考已有的两个通信协议:
- AsyncTcp/AsyncTcpServer/BeginEndFilter.cs
- AsyncTcp/AsyncTcpServer/BeginDataLenVerifyFilter.cs。
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
This package has no dependencies.
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.0.0.2 | 390 | 1/17/2021 |