This repository has been archived on 2025-10-29. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
FPGA_WebLab/server/src/MsgBus.cs
2025-07-14 17:15:35 +08:00

38 lines
861 B
C#

/// <summary>
/// 多线程通信总线
/// </summary>
public static class MsgBus
{
private static readonly UDPServer udpServer = new UDPServer(1234, 12);
/// <summary>
/// 获取UDP服务器
/// </summary>
public static UDPServer UDPServer { get { return udpServer; } }
private static bool isRunning = false;
/// <summary>
/// 获取通信总线运行状态
/// </summary>
public static bool IsRunning { get { return isRunning; } }
/// <summary>
/// 通信总线初始化
/// </summary>
/// <returns>无</returns>
public static void Init()
{
udpServer.Start();
isRunning = true;
}
/// <summary>
/// 关闭通信总线
/// </summary>
/// <returns>无</returns>
public static void Exit()
{
udpServer.Stop();
isRunning = false;
}
}