VS_FileSendTool/FS/Server/ConnectAndMsgPlugin.cs

42 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TouchSocket.Core;
using TouchSocket.Dmtp;
using TouchSocket.NamedPipe;
using TouchSocket.Sockets;
namespace Server
{
internal class ConnectAndMsgPlugin : PluginBase, IDmtpClosedPlugin, IDmtpHandshakedPlugin, IDmtpReceivedPlugin
{
private readonly ILog m_logger;
public ConnectAndMsgPlugin(ILog logger)
{
this.m_logger = logger;
}
public async Task OnDmtpClosed(IDmtpActorObject client, ClosedEventArgs e)
{
this.m_logger.Info($"messageType is [OnDmtpClosed],{client.ToString}, {e.Message}");
await e.InvokeNext();
}
public async Task OnDmtpHandshaked(IDmtpActorObject client, DmtpVerifyEventArgs e)
{
this.m_logger.Info($"messageType is [OnDmtpHandshaked], {client.ToJsonString}, {e.Message}");
await e.InvokeNext();
}
public async Task OnDmtpReceived(IDmtpActorObject client, DmtpMessageEventArgs e)
{
this.m_logger.Info($"messageType is [OnDmtpReceived], {client}, {e.DmtpMessage}");
await e.InvokeNext();
}
}
}