mirror of
https://github.com/ThingsGateway/ThingsGateway.git
synced 2026-10-26 02:17:58 +08:00
update the tcpserver class and add log output for start and stop
This commit is contained in:
+2
-2
@@ -26,10 +26,10 @@
|
||||
<MTextField Class="ma-1" Style="max-width:100px" Label="端口" Dense Outlined HideDetails="@("auto")" @bind-Value=@port />
|
||||
|
||||
<MButton Class="ma-1" OnClick=@Connect Color="primary">
|
||||
连接
|
||||
启动
|
||||
</MButton>
|
||||
<MButton Class="ma-1" OnClick=@DisConnect Color="red">
|
||||
断开
|
||||
停止
|
||||
</MButton>
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -55,7 +55,8 @@ public abstract class ReadWriteDevicesTcpServerBase : ReadWriteDevicesBase
|
||||
/// <inheritdoc/>
|
||||
public override Task ConnectAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.Run(() => TcpService.Start());
|
||||
Connect(cancellationToken);
|
||||
return EasyTask.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
+6
@@ -493,6 +493,11 @@ namespace ThingsGateway.Foundation.Sockets
|
||||
/// </summary>
|
||||
public override IService Stop()
|
||||
{
|
||||
foreach (var item in m_monitors)
|
||||
{
|
||||
Logger.Info($"{item.Option.IpHost}停止成功");
|
||||
}
|
||||
|
||||
foreach (var item in this.m_monitors)
|
||||
{
|
||||
item.Socket.SafeDispose();
|
||||
@@ -603,6 +608,7 @@ namespace ThingsGateway.Foundation.Sockets
|
||||
foreach (var item in optionList)
|
||||
{
|
||||
this.AddListen(item);
|
||||
Logger.Info($"{item.IpHost}启动成功");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user