1
liulijun
2026-02-03 69f2d2a5b14ee9edc242c3fc9c69dd8180941823
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using System;
using System.IO;
 
namespace WIDESEAWCS_Tasks.SocketServer
{
    public partial class TcpSocketServer
    {
        public void Dispose()
        {
            _cts?.Cancel();
            _listener?.Stop();
            _cts?.Dispose();
            foreach (var sem in _clientLocks.Values) { try { sem.Dispose(); } catch { } }
            _clientLocks.Clear();
            Log($"[{DateTime.Now}] TcpSocketServer stopped");
        }
    }
}