日志显示,修改缓冲区

This commit is contained in:
sc committed 2025-09-29 01:02:28 +08:00
commit 8d0b37f0e2
3 files changed
+15 -23

No files matched your search

+3 -1
View File
@@ -262,6 +262,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
return EasyTask.CompletedTask; ;
};
await portclient.SetupAsync(new TouchSocketConfig()
.SetMaxBufferSize(1024 * 1024 * 100)
.SetSerialPortOption(new SerialPortOption()
{
BaudRate = BAUD,//波特率
@@ -274,7 +275,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
.ConfigurePlugins(a =>
{
//a.Add<MyPlugin>();
}));
}
));
try
{
await portclient.ConnectAsync();
+6 -20
View File
@@ -383,38 +383,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
//载入配置
await tcpClient.SetupAsync(new TouchSocketConfig()
.SetMaxBufferSize(1024*1024)
.SetMinBufferSize(1024*64)
.SetMaxBufferSize(1024* 1024*100)
.SetMinBufferSize(1024*1024)
.SetRemoteIPHost(ip + ":" + port)
.ConfigurePlugins(a =>
{
//触发型重连
// a.UseTcpReconnection();
//使用Polling轮询连接插件
a.UseTcpReconnection()
.UsePolling(TimeSpan.FromSeconds(5));
})
.ConfigureContainer(a =>
{
// a.AddConsoleLogger();//添加一个日志注入
}));
// Result result = await
}
));
await tcpClient.TryConnectAsync();
// return result.IsSuccess;
/* try
{
await tcpClient.ConnectAsync();//调用连接,当连接不成功时,会抛出异常。
return true;
}
catch
{
return false;
}*/
}
}
}