# SerialPortForward
**Repository Path**: itldg/serial-port-forward
## Basic Information
- **Project Name**: SerialPortForward
- **Description**: 两个串口相互转发,用于协议分析
- **Primary Language**: C#
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: https://www.itldg.com/
- **GVP Project**: No
## Statistics
- **Stars**: 93
- **Forks**: 30
- **Created**: 2022-07-28
- **Last Updated**: 2025-05-07
## Categories & Tags
**Categories**: networklib
**Tags**: 串口转发, 串口校验, 协议分析
## README
# 串口转发程序
实现两个串口间数据转发,并展示通讯过程
方便做数据获取使用
### 界面演示




数据分析插件

### 实现功能
- 串口转发(自定义设置分包合并和轮询)
- 网络串口(TCP Server,TCP Client)
- 协议记录,支持编辑自动回复
- 定时发送和手动发送消息给串口
- 发送数据自动计算校验,可自己开发校验插件
- 自定义消息处理插件,可以对消息记录或者整理后再进行转发
### 插件方法
插件示例:[Gitee](https://gitee.com/itldg/SerialPortForwardPluginExample) [GitHub](https://github.com/itldg/SerialPortForwardPluginExample)
```csharp
public interface IPlugin
{
///
/// 插件名称
///
string Name { get; }
///
/// 插件被选中
///
/// 插件公用方法
void Checked(PluginCommon plugin);
///
/// 插件被取消选中
///
void UnCheck();
///
/// 插件处理过程
///
/// 是否是COM1
/// 串口名称
/// 收到的数据
/// 答复数据,如果返回数组长度大于0则自动答复
byte[] GetBytes(bool IsCom1, string ComName, ref byte[] Bytes);
///
/// 是否存在选项
///
bool HasOption { get; }
///
/// 点击了插件选项
///
void Option();
}
```