Skip to content

Instantly share code, notes, and snippets.

@deeja
Last active May 27, 2020 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deeja/261ae5260b945efddddaaef270aa1b58 to your computer and use it in GitHub Desktop.
Save deeja/261ae5260b945efddddaaef270aa1b58 to your computer and use it in GitHub Desktop.
UdpClient for local data receive - Works on dotnet core
internal class Program
{
private const int PORT = 4843;
private static void Main(string[] args)
{
Console.WriteLine("Packet Forwarding UP!");
var client = new UdpClient(PORT);
var ipEndPoint = new IPEndPoint(IPAddress.Loopback, PORT);
while (true)
{
Console.Write("Waiting... ");
var receive = client.Receive(ref ipEndPoint);
Console.WriteLine(" - Received Data - " + receive.Length);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment