Merge branch 'LoopTest'

This commit is contained in:
SHM
2025-11-10 09:15:03 +09:00
2 changed files with 49 additions and 23 deletions

View File

@ -17,8 +17,8 @@ namespace CPMeta
{
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
RequestClient.Timeout = TimeSpan.FromMilliseconds(3000);
ResponseClient.Timeout = TimeSpan.FromMilliseconds(3000);
RequestClient.Timeout = TimeSpan.FromMilliseconds(10000);
ResponseClient.Timeout = TimeSpan.FromMilliseconds(10000);
}
public static async Task<RESPONSE> PostAsync<REQUEST,RESPONSE>(string Url, REQUEST body) where REQUEST : class where RESPONSE : class

View File

@ -1,9 +1,11 @@
using CPMeta;
using CPMeta.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace PlayGround.NetFramework
@ -12,33 +14,57 @@ namespace PlayGround.NetFramework
{
static void Main(string[] args)
{
//global set
string host = "192.168.0.126";
//CpMetaSet
CPMeta.CPMeta.Port = 9000;
//CPMeta.CPMeta.Port = 9000;
string ProductId = Guid.NewGuid().ToString();
string Mac1 = Guid.NewGuid().ToString();
string Mac2 = Guid.NewGuid().ToString();
//DateTime start = DateTime.Now;
//Task.Run(async () =>
//{
// var rese2 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress("192.168.0.126", "4594095f-01d0-4192-bc4a-0913ae496e25");
// //var rese2 = await CPMeta.CPMeta.GetWbmsMetaByProductId(host, "cf35eeee-39ff-43e8-a7a9-0fd0baf6df2b");
// Console.WriteLine(JsonConvert.SerializeObject(rese2, Formatting.Indented));
// int c = 0;
//}).Wait();
//Set
Task.Run(async() =>
//Console.WriteLine((DateTime.Now - start).TotalSeconds + " sec");
for (int i = 0; i < 1000000; i++)
{
Request_SetWbmsMeta req = new Request_SetWbmsMeta();
req.ProductID = ProductId;
req.MacAddress1 = Mac1;
req.MacAddress2 = Mac2;
string ProductId = Guid.NewGuid().ToString();
string Mac1 = Guid.NewGuid().ToString();
string Mac2 = Guid.NewGuid().ToString();
var res = await CPMeta.CPMeta.SetWbmsMetaAsync("127.0.0.1", req);
}).Wait();
//Get
Task.Run(async() =>
{
var rese2 = await CPMeta.CPMeta.GetWbmsMetaByProductId("127.0.0.1", ProductId);
//Set
Task.Run(async () =>
{
Request_SetWbmsMeta req = new Request_SetWbmsMeta();
req.ProductID = ProductId;
req.MacAddress1 = Mac1;
req.MacAddress2 = Mac2;
var rese3 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress("127.0.0.1", Mac1);
var rese4 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress("127.0.0.1", Mac2);
int b = 0;
}).Wait();;
if (i % 2 == 0)
req.Type = "CMU";
else
req.Type = "BMU";
req.ProductNo = "X";
var res = await CPMeta.CPMeta.SetWbmsMetaAsync(host, req);
}).Wait();
//Get
//Task.Run(async () =>
//{
// var rese2 = await CPMeta.CPMeta.GetWbmsMetaByProductId(host, ProductId);
// var rese3 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress(host, Mac1);
// var rese4 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress("192.168.0.126", Mac2);
//}).Wait();
Thread.Sleep(100);
}
int a = 0;
}