fix bug: couldn't convert package
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DotNext;
|
||||
using DotNext.Threading;
|
||||
using Newtonsoft.Json;
|
||||
@@ -392,6 +393,23 @@ public class UDPServer
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空指定IP地址的数据
|
||||
/// </summary>
|
||||
/// <param name="ipAddr">IP地址</param>
|
||||
/// <returns>无</returns>
|
||||
public async Task ClearUDPData(string ipAddr)
|
||||
{
|
||||
using (await udpData.AcquireWriteLockAsync())
|
||||
{
|
||||
if (udpData.TryGetValue(ipAddr, out var dataQueue) && dataQueue.Count > 0)
|
||||
{
|
||||
dataQueue.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Start UDP Server
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user