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