SimpleUdp 2.0.2

dotnet add package SimpleUdp --version 2.0.2                
NuGet\Install-Package SimpleUdp -Version 2.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SimpleUdp" Version="2.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimpleUdp --version 2.0.2                
#r "nuget: SimpleUdp, 2.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SimpleUdp as a Cake Addin
#addin nuget:?package=SimpleUdp&version=2.0.2

// Install SimpleUdp as a Cake Tool
#tool nuget:?package=SimpleUdp&version=2.0.2                

alt tag

SimpleUdp

Simple wrapper for UDP client and server in C#

NuGet Version NuGet

SimpleUdp provides simple methods for creating your own UDP-based sockets application, enabling easy integration of sending data, receiving data, and building state machines.

New in v2.0.x

  • Retarget to .NET 8.0
  • Removal of Start, Stop APIs, and, the started event
  • Better multi-platform compatibility (Windows, Mac OSX, Ubuntu)

Help or Feedback

Need help or have feedback? Please file an issue here!

Special Thanks

Thanks to community members that have helped improve this library! @jholzer @charleypeng @seatrix

Need TCP Instead?

I have you covered.

Don't know what to use? Just ask! File an issue, I'll be happy to help.

Simple Example

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));
} 

The Node Project

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!

Version History

Please refer to CHANGELOG.md.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on SimpleUdp:

Package Downloads
View.Models

View.io is currently in BETA. Database models and supporting classes for View.io services.

Simple.K.Socket

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.2 977 4/8/2024
2.0.1 284 3/21/2024
1.2.4 128 4/8/2024
1.2.2 544 1/11/2024
1.2.1 13,485 8/15/2022
1.2.0 1,336 4/4/2022
1.1.0.1 494 3/30/2022
1.1.0 452 3/29/2022
1.0.0.5 1,639 11/12/2021
1.0.0.4 1,269 11/17/2020
1.0.0.3 422 11/15/2020
1.0.0.2 14,482 8/11/2020
1.0.0.1 3,028 7/23/2020
1.0.0 494 7/23/2020

Breaking changes to accommodate multi-platform