2024-09-30 17:10:43 +08:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
using TouchSocket.Core;
|
|
|
|
|
|
using TouchSocket.Sockets;
|
|
|
|
|
|
|
|
|
|
|
|
namespace JiShe.CollectBus.Core.Plugins
|
|
|
|
|
|
{
|
2024-10-30 18:01:33 +08:00
|
|
|
|
public partial class UdpServicePlugin : PluginBase
|
2024-09-30 17:10:43 +08:00
|
|
|
|
{
|
2024-10-22 20:57:26 +08:00
|
|
|
|
[GeneratorPlugin(typeof(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();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|