Untitled
unknown
plain_text
2 years ago
760 B
7
Indexable
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
UdpClient udpServer = new UdpClient(5000);
IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0);
Console.WriteLine("Server started.");
while (true)
{
var receivedResults = await udpServer.ReceiveAsync();
byte[] receivedBytes = receivedResults.Buffer;
IPEndPoint clientEndPoint = receivedResults.RemoteEndPoint;
// Echo the audio data back to the client
await udpServer.SendAsync(receivedBytes, receivedBytes.Length, clientEndPoint);
}
}
}
Editor is loading...
Leave a Comment