2024-10-30 18:01:33 +08:00

20 lines
592 B
C#

using System.Text;
using TouchSocket.Core;
using TouchSocket.Sockets;
namespace JiShe.CollectBus.Core.Plugins
{
public partial class UdpServicePlugin : PluginBase
{
[GeneratorPlugin(typeof(IUdpReceivedPlugin))]
public async Task OnUdpReceived(IUdpSessionBase client, UdpReceivedDataEventArgs e)
{
var udpSession = client as UdpSession;
udpSession?.Logger.Info($"[UDP] 收到:{e.ByteBlock.Span.ToString(Encoding.UTF8)}");
await udpSession.SendAsync("[UDP] 收到");
await e.InvokeNext();
}
}
}