Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightAggregationManager
This commit is contained in:
commit
a0eeb9c8c4
1 file changed
+28
-21
+28
-21
@@ -137,31 +137,38 @@ namespace SunlightAggregationManager.UserClass
|
||||
};
|
||||
#endregion
|
||||
|
||||
try
|
||||
while (true)
|
||||
{
|
||||
await tcpClient.SetupAsync(new TouchSocketConfig()
|
||||
.SetSingleStreamDataHandlingAdapter(() => new PeriodPackageAdapter())//以超时周期和包
|
||||
.SetRemoteIPHost(ip)
|
||||
.ConfigurePlugins(a =>
|
||||
{
|
||||
a.UseReconnection<TouchSocket.Sockets.TcpClient>(options =>
|
||||
try
|
||||
{
|
||||
await tcpClient.SetupAsync(new TouchSocketConfig()
|
||||
.SetSingleStreamDataHandlingAdapter(() => new PeriodPackageAdapter())//以超时周期和包
|
||||
.SetRemoteIPHost(ip)
|
||||
.ConfigurePlugins(a =>
|
||||
{
|
||||
options.PollingInterval = TimeSpan.FromSeconds(5);
|
||||
});
|
||||
|
||||
})
|
||||
.ConfigureContainer(a =>
|
||||
{
|
||||
|
||||
}));
|
||||
a.UseReconnection<TouchSocket.Sockets.TcpClient>(options =>
|
||||
{
|
||||
options.PollingInterval = TimeSpan.FromSeconds(5);
|
||||
});
|
||||
|
||||
await tcpClient.ConnectAsync();//调用连接,当连接不成功时,会抛出异常。
|
||||
})
|
||||
.ConfigureContainer(a =>
|
||||
{
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex);
|
||||
Console.WriteLine("Tcp:" + ex.ToString());
|
||||
}));
|
||||
|
||||
await tcpClient.ConnectAsync();//调用连接,当连接不成功时,会抛出异常。
|
||||
break;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
tcpClient.Dispose();//清
|
||||
LogGing.ERRDATA(ex);
|
||||
Console.WriteLine("Tcp:" + ex.ToString());
|
||||
await Task.Delay(TimeSpan.FromMinutes(1));
|
||||
Console.WriteLine("Tcp:重试连接...");
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void TimerCallback(object? state)
|
||||
|
||||
Reference in new issue
Block a user