瀏覽代碼

解决多台机器同时访问时终端号冲突

tags/v2.3.1
SmallChi(Koike) 5 年之前
父節點
當前提交
237b1e3c30
共有 4 個檔案被更改,包括 9 行新增3 行删除
  1. +5
    -0
      src/JT808.DotNetty.CleintBenchmark/Configs/ClientBenchmarkOptions.cs
  2. +1
    -1
      src/JT808.DotNetty.CleintBenchmark/JT808.DotNetty.CleintBenchmark.csproj
  3. +1
    -1
      src/JT808.DotNetty.CleintBenchmark/Services/CleintBenchmarkHostedService.cs
  4. +2
    -1
      src/JT808.DotNetty.CleintBenchmark/appsettings.json

+ 5
- 0
src/JT808.DotNetty.CleintBenchmark/Configs/ClientBenchmarkOptions.cs 查看文件

@@ -14,6 +14,11 @@ namespace JT808.DotNetty.CleintBenchmark.Configs
/// 5000ms毫秒 /// 5000ms毫秒
/// </summary> /// </summary>
public int Interval { get; set; } = 5000; public int Interval { get; set; } = 5000;
/// <summary>
/// 需要多台机器同时访问,那么可以根据这个避开重复终端号
/// 100000-200000-300000
/// </summary>
public int DeviceTemplate { get; set; } = 0;
public ClientBenchmarkOptions Value =>this; public ClientBenchmarkOptions Value =>this;
} }
} }

+ 1
- 1
src/JT808.DotNetty.CleintBenchmark/JT808.DotNetty.CleintBenchmark.csproj 查看文件

@@ -2,7 +2,7 @@


<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>7.3</LangVersion> <LangVersion>7.3</LangVersion>
</PropertyGroup> </PropertyGroup>




+ 1
- 1
src/JT808.DotNetty.CleintBenchmark/Services/CleintBenchmarkHostedService.cs 查看文件

@@ -51,7 +51,7 @@ namespace JT808.DotNetty.CleintBenchmark.Services
{ {
taskFactory.StartNew((item) => taskFactory.StartNew((item) =>
{ {
var client = jT808TcpClientFactory.Create(new JT808DeviceConfig(((int)item+1).ToString(), clientBenchmarkOptions.IP, clientBenchmarkOptions.Port));
var client = jT808TcpClientFactory.Create(new JT808DeviceConfig(((int)item+1+ clientBenchmarkOptions.DeviceTemplate).ToString(), clientBenchmarkOptions.IP, clientBenchmarkOptions.Port));
int lat = new Random(1000).Next(100000, 180000); int lat = new Random(1000).Next(100000, 180000);
int Lng = new Random(1000).Next(100000, 180000); int Lng = new Random(1000).Next(100000, 180000);
while (!cts.IsCancellationRequested) while (!cts.IsCancellationRequested)


+ 2
- 1
src/JT808.DotNetty.CleintBenchmark/appsettings.json 查看文件

@@ -15,6 +15,7 @@
"ClientBenchmarkOptions": { "ClientBenchmarkOptions": {
"IP": "", "IP": "",
"Port": 808, "Port": 808,
"DeviceCount": 1
"DeviceCount": 100,
"DeviceTemplate": 300000 //需要多台机器同时访问,那么可以根据这个避开重复终端号 100000-200000-300000
} }
} }

Loading…
取消
儲存