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