From 237b1e3c30019ce4136af30e0042b5cbc9f11e85 Mon Sep 17 00:00:00 2001
From: "SmallChi(Koike)" <564952747@qq.com>
Date: Sun, 15 Dec 2019 20:36:57 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=A4=9A=E5=8F=B0=E6=9C=BA?=
=?UTF-8?q?=E5=99=A8=E5=90=8C=E6=97=B6=E8=AE=BF=E9=97=AE=E6=97=B6=E7=BB=88?=
=?UTF-8?q?=E7=AB=AF=E5=8F=B7=E5=86=B2=E7=AA=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Configs/ClientBenchmarkOptions.cs | 5 +++++
.../JT808.DotNetty.CleintBenchmark.csproj | 2 +-
.../Services/CleintBenchmarkHostedService.cs | 2 +-
src/JT808.DotNetty.CleintBenchmark/appsettings.json | 3 ++-
4 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/JT808.DotNetty.CleintBenchmark/Configs/ClientBenchmarkOptions.cs b/src/JT808.DotNetty.CleintBenchmark/Configs/ClientBenchmarkOptions.cs
index 564da09..d1842d1 100644
--- a/src/JT808.DotNetty.CleintBenchmark/Configs/ClientBenchmarkOptions.cs
+++ b/src/JT808.DotNetty.CleintBenchmark/Configs/ClientBenchmarkOptions.cs
@@ -14,6 +14,11 @@ namespace JT808.DotNetty.CleintBenchmark.Configs
/// 5000ms毫秒
///
public int Interval { get; set; } = 5000;
+ ///
+ /// 需要多台机器同时访问,那么可以根据这个避开重复终端号
+ /// 100000-200000-300000
+ ///
+ public int DeviceTemplate { get; set; } = 0;
public ClientBenchmarkOptions Value =>this;
}
}
diff --git a/src/JT808.DotNetty.CleintBenchmark/JT808.DotNetty.CleintBenchmark.csproj b/src/JT808.DotNetty.CleintBenchmark/JT808.DotNetty.CleintBenchmark.csproj
index 8983666..cc4b46b 100644
--- a/src/JT808.DotNetty.CleintBenchmark/JT808.DotNetty.CleintBenchmark.csproj
+++ b/src/JT808.DotNetty.CleintBenchmark/JT808.DotNetty.CleintBenchmark.csproj
@@ -2,7 +2,7 @@
Exe
- netcoreapp3.0
+ netcoreapp3.1
7.3
diff --git a/src/JT808.DotNetty.CleintBenchmark/Services/CleintBenchmarkHostedService.cs b/src/JT808.DotNetty.CleintBenchmark/Services/CleintBenchmarkHostedService.cs
index a4811df..b6d61ab 100644
--- a/src/JT808.DotNetty.CleintBenchmark/Services/CleintBenchmarkHostedService.cs
+++ b/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)
diff --git a/src/JT808.DotNetty.CleintBenchmark/appsettings.json b/src/JT808.DotNetty.CleintBenchmark/appsettings.json
index fe9b3c0..eb6044b 100644
--- a/src/JT808.DotNetty.CleintBenchmark/appsettings.json
+++ b/src/JT808.DotNetty.CleintBenchmark/appsettings.json
@@ -15,6 +15,7 @@
"ClientBenchmarkOptions": {
"IP": "",
"Port": 808,
- "DeviceCount": 1
+ "DeviceCount": 100,
+ "DeviceTemplate": 300000 //需要多台机器同时访问,那么可以根据这个避开重复终端号 100000-200000-300000
}
}