add nlog for server

This commit is contained in:
2025-04-09 19:42:29 +08:00
parent 5c0f5b2127
commit 143d6c634b
11 changed files with 358 additions and 77 deletions

View File

@@ -1,19 +1,36 @@
/// <summary>
/// 多线程通信总线
/// </summary>
public static class MsgBus
{
private static readonly UDPServer udpServer = new UDPServer(33000);
private static readonly UDPServer udpServer = new UDPServer(1234);
/// <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();