2024-09-30 17:10:43 +08:00
|
|
|
|
using System.Text;
|
2024-12-19 16:07:07 +08:00
|
|
|
|
using System.Threading.Tasks;
|
2024-09-30 17:10:43 +08:00
|
|
|
|
using TouchSocket.Core;
|
|
|
|
|
|
using TouchSocket.Sockets;
|
|
|
|
|
|
|
2024-12-19 16:07:07 +08:00
|
|
|
|
namespace JiShe.CollectBus.Plugins
|
2024-09-30 17:10:43 +08:00
|
|
|
|
{
|
2025-03-27 08:38:19 +08:00
|
|
|
|
public partial class UdpMonitor : PluginBase, IUdpReceivedPlugin
|
2024-09-30 17:10:43 +08:00
|
|
|
|
{
|
|
|
|
|
|
public async Task OnUdpReceived(IUdpSessionBase client, UdpReceivedDataEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
var udpSession = client as UdpSession;
|
2024-10-08 15:06:08 +08:00
|
|
|
|
udpSession?.Logger.Info($"[UDP] 收到:{e.ByteBlock.Span.ToString(Encoding.UTF8)}");
|
|
|
|
|
|
await udpSession.SendAsync("[UDP] 收到");
|
2024-09-30 17:10:43 +08:00
|
|
|
|
|
|
|
|
|
|
await e.InvokeNext();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|