Merge branch 'LoopTest'
This commit is contained in:
@ -17,8 +17,8 @@ namespace CPMeta
|
|||||||
{
|
{
|
||||||
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
|
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
|
||||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||||
RequestClient.Timeout = TimeSpan.FromMilliseconds(3000);
|
RequestClient.Timeout = TimeSpan.FromMilliseconds(10000);
|
||||||
ResponseClient.Timeout = TimeSpan.FromMilliseconds(3000);
|
ResponseClient.Timeout = TimeSpan.FromMilliseconds(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<RESPONSE> PostAsync<REQUEST,RESPONSE>(string Url, REQUEST body) where REQUEST : class where RESPONSE : class
|
public static async Task<RESPONSE> PostAsync<REQUEST,RESPONSE>(string Url, REQUEST body) where REQUEST : class where RESPONSE : class
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
using CPMeta;
|
using CPMeta;
|
||||||
using CPMeta.Models;
|
using CPMeta.Models;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace PlayGround.NetFramework
|
namespace PlayGround.NetFramework
|
||||||
@ -12,9 +14,25 @@ namespace PlayGround.NetFramework
|
|||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
//CpMetaSet
|
//global set
|
||||||
CPMeta.CPMeta.Port = 9000;
|
string host = "192.168.0.126";
|
||||||
|
|
||||||
|
//CpMetaSet
|
||||||
|
//CPMeta.CPMeta.Port = 9000;
|
||||||
|
|
||||||
|
//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();
|
||||||
|
|
||||||
|
//Console.WriteLine((DateTime.Now - start).TotalSeconds + " sec");
|
||||||
|
|
||||||
|
for (int i = 0; i < 1000000; i++)
|
||||||
|
{
|
||||||
string ProductId = Guid.NewGuid().ToString();
|
string ProductId = Guid.NewGuid().ToString();
|
||||||
string Mac1 = Guid.NewGuid().ToString();
|
string Mac1 = Guid.NewGuid().ToString();
|
||||||
string Mac2 = Guid.NewGuid().ToString();
|
string Mac2 = Guid.NewGuid().ToString();
|
||||||
@ -27,18 +45,26 @@ namespace PlayGround.NetFramework
|
|||||||
req.MacAddress1 = Mac1;
|
req.MacAddress1 = Mac1;
|
||||||
req.MacAddress2 = Mac2;
|
req.MacAddress2 = Mac2;
|
||||||
|
|
||||||
var res = await CPMeta.CPMeta.SetWbmsMetaAsync("127.0.0.1", req);
|
if (i % 2 == 0)
|
||||||
|
req.Type = "CMU";
|
||||||
|
else
|
||||||
|
req.Type = "BMU";
|
||||||
|
|
||||||
|
req.ProductNo = "X";
|
||||||
|
|
||||||
|
var res = await CPMeta.CPMeta.SetWbmsMetaAsync(host, req);
|
||||||
}).Wait();
|
}).Wait();
|
||||||
|
|
||||||
//Get
|
//Get
|
||||||
Task.Run(async() =>
|
//Task.Run(async () =>
|
||||||
{
|
//{
|
||||||
var rese2 = await CPMeta.CPMeta.GetWbmsMetaByProductId("127.0.0.1", ProductId);
|
// 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();
|
||||||
|
|
||||||
var rese3 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress("127.0.0.1", Mac1);
|
Thread.Sleep(100);
|
||||||
var rese4 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress("127.0.0.1", Mac2);
|
}
|
||||||
int b = 0;
|
|
||||||
}).Wait();;
|
|
||||||
|
|
||||||
int a = 0;
|
int a = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user