完善契约与客户端、服务端的收发代码

This commit is contained in:
2026-01-03 00:16:28 +08:00
parent d039559402
commit dcf424a86e
30 changed files with 3292 additions and 349 deletions

View File

@@ -0,0 +1,71 @@
using System;
namespace SHH.Contracts
{
/// <summary>
/// 服务端身份注册信息 (DTO)
/// <para>用于服务端主动连上客户端后,上报自身的端口和身份信息</para>
/// </summary>
public class ServerRegistrationDto
{
#region --- 1. ---
/// <summary>
/// 进程 ID (用于区分同一台机器上的多个实例)
/// </summary>
public int ProcessId { get; set; }
/// <summary>
/// 实例唯一标识符
/// <para>启动时通过命令行传入,例如 "Gateway_Factory_A"</para>
/// </summary>
public string InstanceId { get; set; }
/// <summary>
/// 服务端版本号
/// </summary>
public string Version { get; set; } = "1.0.0";
#endregion
#region --- 2. () ---
/// <summary>
/// 服务端所在的局域网 IP
/// <para>客户端无法直接连接此IP(因为可能是内网),但运维人员需要知道</para>
/// </summary>
public string ServerIp { get; set; }
/// <summary>
/// WebAPI 监听端口 (HTTP)
/// <para>用于运维人员打开 Swagger 进行调试</para>
/// </summary>
public int WebApiPort { get; set; }
/// <summary>
/// 视频流端口 (ZeroMQ Publisher/Push)
/// </summary>
public int VideoPort { get; set; }
/// <summary>
/// 指令流端口 (ZeroMQ Response)
/// </summary>
public int CmdPort { get; set; }
#endregion
#region --- 3. ---
/// <summary>
/// 启动时间
/// </summary>
public DateTime StartTime { get; set; }
/// <summary>
/// 描述信息 (可选)
/// </summary>
public string Description { get; set; }
#endregion
}
}