add basic web protocol
This commit is contained in:
@@ -6,9 +6,29 @@ class UDPClientPool
|
||||
{
|
||||
private static IPAddress localhost = IPAddress.Parse("127.0.0.1");
|
||||
|
||||
public UDPClientPool()
|
||||
public static void SendString(IPEndPoint endPoint, string[] stringArray)
|
||||
{
|
||||
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||
|
||||
byte[] sendbuf = Encoding.ASCII.GetBytes(stringArray[0]);
|
||||
|
||||
socket.SendTo(sendbuf, endPoint);
|
||||
}
|
||||
|
||||
public async static void AsyncSendString(IPEndPoint endPoint, string[] stringArray)
|
||||
{
|
||||
await Task.Run(() => { SendString(endPoint, stringArray); });
|
||||
}
|
||||
|
||||
public static void SendBytes(IPEndPoint endPoint, byte[] buf)
|
||||
{
|
||||
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||
socket.SendTo(buf, endPoint);
|
||||
}
|
||||
|
||||
public async static void AsyncSendBytes(IPEndPoint endPoint, byte[] buf)
|
||||
{
|
||||
await Task.Run(() => { SendBytes(endPoint, buf); });
|
||||
}
|
||||
|
||||
public static void SendLocalHost(int port, string[] stringArray)
|
||||
@@ -34,8 +54,4 @@ class UDPClientPool
|
||||
Thread.Sleep(sleepMilliSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user