소스 검색

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

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毫秒
/// </summary>
public int Interval { get; set; } = 5000;
/// <summary>
/// 需要多台机器同时访问,那么可以根据这个避开重复终端号
/// 100000-200000-300000
/// </summary>
public int DeviceTemplate { get; set; } = 0;
public ClientBenchmarkOptions Value =>this;
}
}

+ 1
- 1
src/JT808.DotNetty.CleintBenchmark/JT808.DotNetty.CleintBenchmark.csproj 파일 보기

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

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



+ 1
- 1
src/JT808.DotNetty.CleintBenchmark/Services/CleintBenchmarkHostedService.cs 파일 보기

@@ -51,7 +51,7 @@ namespace JT808.DotNetty.CleintBenchmark.Services
{
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 Lng = new Random(1000).Next(100000, 180000);
while (!cts.IsCancellationRequested)


+ 2
- 1
src/JT808.DotNetty.CleintBenchmark/appsettings.json 파일 보기

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

불러오는 중...
취소
저장