finish web test api

This commit is contained in:
2025-03-31 20:24:26 +08:00
parent f455af3589
commit 0da5b85173
10 changed files with 392 additions and 59 deletions

View File

@@ -31,6 +31,28 @@ class UDPClientPool
await Task.Run(() => { SendBytes(endPoint, buf); });
}
public static void SendAddrPack(IPEndPoint endPoint, WebProtocol.SendAddrPackage pkg)
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
socket.SendTo(pkg.ToBytes(), endPoint);
}
public async static void AsyncSendAddrPack(IPEndPoint endPoint, WebProtocol.SendAddrPackage pkg)
{
await Task.Run(() => { SendAddrPack(endPoint, pkg); });
}
public static void SendDataPack(IPEndPoint endPoint, WebProtocol.SendDataPackage pkg)
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
socket.SendTo(pkg.ToBytes(), endPoint);
}
public async static void AsyncSendDataPack(IPEndPoint endPoint, WebProtocol.SendDataPackage pkg)
{
await Task.Run(() => { SendDataPack(endPoint, pkg); });
}
public static void SendLocalHost(int port, string[] stringArray)
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);