修改了http服务器无法正确处理post请求入参;添加了modbus tcp客户端支持。

This commit is contained in:
fengjiayi
2025-07-23 15:57:57 +08:00
parent acf0b87ad0
commit 4e20e816ae
24 changed files with 2466 additions and 189 deletions

View File

@@ -2,6 +2,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
using System.Threading.Tasks;
@@ -47,8 +48,15 @@ namespace Serein.Library.Web
{
while (listener.IsListening)
{
var context = await listener.GetContextAsync(); // 获取请求上下文
ProcessRequestAsync(context); // 处理请求
try
{
var context = await listener.GetContextAsync(); // 获取请求上下文
await ProcessRequestAsync(context); // 处理请求
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
});
}
@@ -84,7 +92,7 @@ namespace Serein.Library.Web
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private async void ProcessRequestAsync(HttpListenerContext context)
private async Task ProcessRequestAsync(HttpListenerContext context)
{
// 添加CORS头部
context.Response.Headers.Add("Access-Control-Allow-Origin", "*");