This commit is contained in:
Administrator committed 2026-06-03 23:32:44 +08:00
commit aee911cc20
3 files changed
+18 -12

No files matched your search

+13 -7
View File
@@ -103,21 +103,17 @@ namespace SunlightAggregationManager.UserClass
MainWindowViewModel.Updata_Memory(MainWindowViewModel._userData, "User='" + deserializedPerson?.User + "'", myDict);
Console.WriteLine("[Log on]User[" + deserializedPerson?.User + "]Note[" + (deserializedPerson?.Dat ?? "unknown") + "]");
CommandC(deserializedPerson?.Dat ?? "NOT", deserializedPerson!);
CommandC(deserializedPerson?.Dat ?? "NOT", deserializedPerson!);
}
else
{//停用账号关闭连接
client.SendAsync("Account Deactivated");
client.SendAsync("Account Deactivated");
}
}
else
{ //无效账号关闭连接
client.SendAsync("Invalid Account");
client.SendAsync("Invalid Account");
}
}
catch (Exception ex)
{//错误
@@ -134,12 +130,22 @@ namespace SunlightAggregationManager.UserClass
await tcpClient.SetupAsync(new TouchSocketConfig()
.SetSingleStreamDataHandlingAdapter(() => new PeriodPackageAdapter())//以超时周期和包
.SetRemoteIPHost(ip)
.SetKeepAliveValue(options => //心跳
{
options.AckInterval = 2000;
options.Interval = 30 * 1000;
})
.ConfigurePlugins(a =>
{
a.UseReconnection<TouchSocket.Sockets.TcpClient>(options =>
{
options.PollingInterval = TimeSpan.FromSeconds(3);
});
})
.ConfigureContainer(a =>
{
}));
await tcpClient.ConnectAsync();//调用连接,当连接不成功时,会抛出异常。