mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-20 10:50:48 +08:00
10.11.51
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<PluginVersion>10.11.44</PluginVersion>
|
||||
<ProPluginVersion>10.11.44</ProPluginVersion>
|
||||
<DefaultVersion>10.11.44</DefaultVersion>
|
||||
<PluginVersion>10.11.51</PluginVersion>
|
||||
<ProPluginVersion>10.11.51</ProPluginVersion>
|
||||
<DefaultVersion>10.11.51</DefaultVersion>
|
||||
<AuthenticationVersion>10.11.5</AuthenticationVersion>
|
||||
<SourceGeneratorVersion>10.11.4</SourceGeneratorVersion>
|
||||
<NET8Version>8.0.20</NET8Version>
|
||||
|
@@ -98,6 +98,19 @@ public static class ChannelOptionsExtensions
|
||||
|
||||
if (channelOptions.MaxClientCount > 0)
|
||||
config.SetMaxCount(channelOptions.MaxClientCount);
|
||||
|
||||
config.SetTransportOption(new TouchSocket.Sockets.TransportOption()
|
||||
{
|
||||
SendPipeOptions = new System.IO.Pipelines.PipeOptions(
|
||||
minimumSegmentSize: 1024,
|
||||
useSynchronizationContext: false),
|
||||
ReceivePipeOptions = new System.IO.Pipelines.PipeOptions(
|
||||
minimumSegmentSize: 1024,
|
||||
pauseWriterThreshold: 1024 * 1024,
|
||||
resumeWriterThreshold: 1024 * 512,
|
||||
useSynchronizationContext: false)
|
||||
});
|
||||
|
||||
switch (channelType)
|
||||
{
|
||||
case ChannelTypeEnum.TcpClient:
|
||||
@@ -125,7 +138,7 @@ public static class ChannelOptionsExtensions
|
||||
/// <param name="config">配置</param>
|
||||
/// <param name="channelOptions">串口配置</param>
|
||||
/// <returns></returns>
|
||||
public static SerialPortChannel GetSerialPort(this TouchSocketConfig config, IChannelOptions channelOptions)
|
||||
private static SerialPortChannel GetSerialPort(this TouchSocketConfig config, IChannelOptions channelOptions)
|
||||
{
|
||||
var serialPortOption = channelOptions.Map<SerialPortOption>();
|
||||
serialPortOption.ThrowIfNull(nameof(SerialPortOption));
|
||||
@@ -143,7 +156,7 @@ public static class ChannelOptionsExtensions
|
||||
/// <param name="channelOptions">通道配置</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public static TcpClientChannel GetTcpClient(this TouchSocketConfig config, IChannelOptions channelOptions)
|
||||
private static TcpClientChannel GetTcpClient(this TouchSocketConfig config, IChannelOptions channelOptions)
|
||||
{
|
||||
var remoteUrl = channelOptions.RemoteUrl;
|
||||
var bindUrl = channelOptions.BindUrl;
|
||||
@@ -165,7 +178,7 @@ public static class ChannelOptionsExtensions
|
||||
/// <param name="channelOptions">通道配置</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public static IChannel GetTcpService(this TouchSocketConfig config, IChannelOptions channelOptions)
|
||||
private static IChannel GetTcpService(this TouchSocketConfig config, IChannelOptions channelOptions)
|
||||
{
|
||||
var bindUrl = channelOptions.BindUrl;
|
||||
bindUrl.ThrowIfNull(nameof(bindUrl));
|
||||
@@ -193,7 +206,7 @@ public static class ChannelOptionsExtensions
|
||||
/// <param name="channelOptions">通道配置</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public static UdpSessionChannel GetUdpSession(this TouchSocketConfig config, IChannelOptions channelOptions)
|
||||
private static UdpSessionChannel GetUdpSession(this TouchSocketConfig config, IChannelOptions channelOptions)
|
||||
{
|
||||
var remoteUrl = channelOptions.RemoteUrl;
|
||||
var bindUrl = channelOptions.BindUrl;
|
||||
|
@@ -40,13 +40,6 @@ public class ModbusBenchmark : IDisposable
|
||||
private List<IModbusMaster> nmodbuss = new();
|
||||
//private List<ModbusTcpNet> modbusTcpNets = new();
|
||||
private List<ModbusTcpMaster> modbusTcpMasters = new();
|
||||
private PipeOptions GetNoDelayPipeOptions()
|
||||
{
|
||||
return new PipeOptions(
|
||||
readerScheduler: PipeScheduler.Inline,
|
||||
writerScheduler: PipeScheduler.Inline,
|
||||
useSynchronizationContext: false);
|
||||
}
|
||||
|
||||
public ModbusBenchmark()
|
||||
{
|
||||
@@ -54,12 +47,8 @@ public class ModbusBenchmark : IDisposable
|
||||
{
|
||||
|
||||
var clientConfig = new TouchSocket.Core.TouchSocketConfig();
|
||||
//clientConfig.SetTransportOption(new TouchSocket.Sockets.TransportOption()
|
||||
//{
|
||||
// ReceivePipeOptions = GetNoDelayPipeOptions(),
|
||||
// SendPipeOptions = GetNoDelayPipeOptions(),
|
||||
//}).SetNoDelay(true);
|
||||
var clientChannel = clientConfig.GetTcpClient(new ChannelOptions() { RemoteUrl = "127.0.0.1:502", MaxConcurrentCount = 10 });
|
||||
|
||||
var clientChannel = clientConfig.GetChannel(new ChannelOptions() { ChannelType = ChannelTypeEnum.TcpClient, RemoteUrl = "127.0.0.1:502", MaxConcurrentCount = 10 });
|
||||
var thingsgatewaymodbus = new ModbusMaster()
|
||||
{
|
||||
//modbus协议格式
|
||||
|
@@ -32,13 +32,7 @@ public class S7Benchmark : IDisposable
|
||||
|
||||
private List<Plc> plcs = new();
|
||||
private List<SiemensS7Net> siemensS7Nets = new();
|
||||
private PipeOptions GetNoDelayPipeOptions()
|
||||
{
|
||||
return new PipeOptions(
|
||||
readerScheduler: PipeScheduler.Inline,
|
||||
writerScheduler: PipeScheduler.Inline,
|
||||
useSynchronizationContext: false);
|
||||
}
|
||||
|
||||
public S7Benchmark()
|
||||
|
||||
{
|
||||
@@ -46,12 +40,8 @@ public class S7Benchmark : IDisposable
|
||||
for (int i = 0; i < Program.ClientCount; i++)
|
||||
{
|
||||
var clientConfig = new TouchSocket.Core.TouchSocketConfig();
|
||||
clientConfig.SetTransportOption(new TouchSocket.Sockets.TransportOption()
|
||||
{
|
||||
ReceivePipeOptions = GetNoDelayPipeOptions(),
|
||||
SendPipeOptions = GetNoDelayPipeOptions(),
|
||||
}).SetNoDelay(true);
|
||||
var clientChannel = clientConfig.GetTcpClient(new ChannelOptions() { RemoteUrl = "127.0.0.1:102" });
|
||||
|
||||
var clientChannel = clientConfig.GetChannel(new ChannelOptions() { ChannelType = ChannelTypeEnum.TcpClient, RemoteUrl = "127.0.0.1:102" });
|
||||
var siemensS7 = new SiemensS7Master()
|
||||
{
|
||||
//modbus协议格式
|
||||
|
@@ -43,7 +43,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.15.2" />
|
||||
<PackageReference Include="HslCommunication" Version="12.5.0" />
|
||||
<PackageReference Include="Longbow.Modbus" Version="9.0.4" />
|
||||
<PackageReference Include="Longbow.Modbus" Version="9.0.5" />
|
||||
<PackageReference Include="NModbus" Version="3.0.81" />
|
||||
<PackageReference Include="NModbus.Serial" Version="3.0.81" />
|
||||
<PackageReference Include="S7netplus" Version="0.20.0" />
|
||||
|
Reference in New Issue
Block a user