SimpleUdp provides simple methods for creating your own UDP-based sockets application, enabling easy integration of sending data, receiving data, and building state machines.
- Retarget to .NET 8.0
- Removal of
Start
,Stop
APIs, and, the started event - Better multi-platform compatibility (Windows, Mac OSX, Ubuntu)
Need help or have feedback? Please file an issue here!
Thanks to community members that have helped improve this library! @jholzer @charleypeng @seatrix
I have you covered.
- WatsonTcp - easiest way to build TCP-based applications with built-in framing
- SimpleTcp - lightweight TCP wrapper without framing
- CavemanTcp - TCP wrapper exposing controls for sending and receiving data to build state machines
Don't know what to use? Just ask! File an issue, I'll be happy to help.
Start a node.
using SimpleUdp;
UdpEndpoint udp = new UdpEndpoint("127.0.0.1", 8000);
udp.EndpointDetected += EndpointDetected;
// only if you want to receive messages...
udp.DatagramReceived += DatagramReceived;
// send a message...
udp.Send("127.0.0.1", 8001, "Hello to my friend listening on port 8001!");
static void EndpointDetected(object sender, EndpointMetadata md)
{
Console.WriteLine("Endpoint detected: " + md.Ip + ":" + md.Port);
}
static void DatagramReceived(object sender, Datagram dg)
{
Console.WriteLine("[" + dg.Ip + ":" + dg.Port + "]: " + Encoding.UTF8.GetString(dg.Data));
}
Start node 1.
Node\bin\Debug\netcoreapp3.1> node 127.0.0.1 8000
Start node 2.
Node\bin\Debug\netcoreapp3.1> node 127.0.0.1 8001
Send message from node 1 to node 2. To do this, enter a command as follows:
[ip:port] [msg]
i.e.
127.0.0.1:8001 hello to my friend running on port 8001!
[127.0.0.1:8000 Command/? for help]: 127.0.0.1:8001 hello to my friend on port 8001!
Send message from node 2 to node 1.
[127.0.0.1:8001 Command/? for help]: Endpoint detected: 127.0.0.1:8000
[127.0.0.1:8000]: hello to my friend on port 8001!
127.0.0.1:8000 hello back to you my friend!
Please refer to CHANGELOG.md.