ArtNetSharp is a modern, cross-platform C# library for the Art-Net 4 protocol. It sends and receives DMX512 and RDM over Ethernet and lets you build Art-Net controllers, nodes and configuration tools, for lighting control, stage automation and interactive installations.
- DMX
- Send DMX as a controller or an input node: unicast to subscribers only, 44 Hz rate limit, keep-alive every 800 ms, sequence numbers
- Receive DMX as an output node, with merging per spec: HTP/LTP, at most two sources (IP + physical port), failed source held for 10 s,
GoodOutputmerge bit - Robust sequence handling: out-of-order packets are dropped, a restarted source is accepted again after a few packets
- Optional
ArtSynconce per frame
- Discovery
ArtPoll/ArtPollReply, including targeted mode- Remote devices and their ports with timeout and revival (the same object comes back, including its RDM devices)
- "ArtPollReply on change" for controllers that request it
- RDM over Art-Net
ArtTodRequest/ArtTodControl/ArtTodData(including more than 200 devices per port)ArtRdmrequests and responses, duplicate detection- RDM transmit queue of gateways (
FifoAvail/FifoMax)
- Remote configuration of nodes
ArtAddress: names, Net / Sub-Net / universes (including reset), merge mode, cancel merge, indicator LEDArtInput: enable / disable DMX inputsArtIpProg: IP programming handed to the application- Every change can be vetoed by the application
- Diagnostics:
ArtDiagDatasending and receiving, as requested by controllers viaArtPoll - ArtData: product, support and user-guide URLs
- Timecode:
ArtTimeCodeandArtTimeSync - Robust for host applications: events run ordered on a queue per instance and are fail-safe, so a slow or throwing handler never blocks or breaks packet reception
- Cross-platform: Windows, Linux and macOS on .NET 8, 9, 10 and 11, including broadcast reception on Linux/macOS (one extra socket per interface)
dotnet add package ArtNetSharp
Or via the NuGet Package Manager in Visual Studio.
All instances live in ArtNet.Instance, which manages the network interfaces (one per IPv4 address) and the sockets on UDP port 6454.
using ArtNetSharp;
using ArtNetSharp.Communication;
var controller = new ControllerInstance(ArtNet.Instance) { Name = "My Controller", ShortName = "MyCtrl" };
// One input port (DMX goes "into" Art-Net) per universe you want to send
var universe = new PortAddress(0, 0, 1); // Net 0, Sub-Net 0, Universe 1
controller.AddPortConfig(new PortConfig(1, universe, false, true) { PortNumber = 1, Type = EPortType.InputToArtNet });
ArtNet.Instance.AddInstance(controller);
byte[] data = new byte[512];
data[0] = 255;
controller.WriteDMXValues(universe, data); // whole frame
controller.WriteDMXValues(universe, new byte[] { 128 }, destinationIndex: 10, count: 1); // single channelThe library discovers the nodes that subscribe to the universe and sends to them at up to 44 Hz, plus a keep-alive.
It only writes when data changed, so calling WriteDMXValues on every change is fine.
var node = new NodeInstance(ArtNet.Instance) { Name = "My Node", ShortName = "MyNode" };
node.AddPortConfig(new PortConfig(1, universe, true, false) { PortNumber = 1, Type = EPortType.OutputFromArtNet });
node.DMXReceived += (sender, portAddress) =>
{
byte[] dmx = node.GetReceivedDMX(portAddress); // merged (HTP/LTP as configured), always a copy
// output dmx ...
};
ArtNet.Instance.AddInstance(node);controller.RemoteClientDiscovered += (_, client) => Console.WriteLine($"Found {client.LongName} at {client.IpAddress}");
controller.RemoteClientTimedOut += (_, client) => Console.WriteLine($"Lost {client.LongName}");
foreach (var client in controller.RemoteClients)
foreach (var port in client.Ports)
Console.WriteLine($"{client.LongName}: out {port.OutputPortAddress} in {port.InputPortAddress}");await controller.PerformRDMDiscovery(universe); // ArtTodRequest -> devices in RemoteClientPort.KnownResponderRDMUIDs
controller.ResponseRDMMessageReceived += (_, e) => Console.WriteLine(e.Response);
await controller.SendArtRDM(new RDMMessage { Command = ERDM_Command.GET_COMMAND, Parameter = ERDM_Parameter.DEVICE_INFO, DestUID = uid });A node with RDM devices (new NodeInstance(ArtNet.Instance, supportRDM: true)) answers requests in RequestRDMMessageReceived via e.SetResponse(...).
Nodes accept ArtAddress, ArtInput and ArtIpProg by default, as Art-Net 4 expects (e.g. from DMX-Workshop).
Every change is announced first and can be rejected:
node.ArtAddressReceived += (_, e) =>
{
if (!IsTrusted(e.Source))
e.Cancel = true; // reject; the node answers with its unchanged ArtPollReply
};
node.ArtInputReceived += (_, e) => { /* a controller enables/disables DMX inputs */ };
node.ArtIpProgReceived += (_, e) =>
{
// The library cannot change the host's network settings. An application that can, applies
// e.Request here and sets e.Ip / e.SubnetMask / e.DefaultGateway / e.DhcpEnabled for the reply.
};To ignore remote configuration completely, derive from NodeInstance and override AcceptArtAddress to return false.
// Controller side: ask devices for diagnostics in our ArtPolls
controller.RequestDiagnostics = true;
controller.DiagnosticsMinimumPriority = EPriorityCode.DpMed;
controller.DiagnosticsReceived += (_, e) => Console.WriteLine($"{e.Source}: {e.Diagnostics.Text}");
// Node side: only sent if a controller requested it (returns false otherwise)
await node.SendDiagnostics("Port 1 output short circuit", EPriorityCode.DpHigh, logicalPort: 1);- Not on the receive thread: events run on a queue per instance, ordered, outside the network receive loops. A slow handler (e.g.
Dispatcher.Invokeon a busy UI thread) only delays later events of the same instance, never packet reception. - Use your own UI thread: handlers run on a thread-pool thread, so switch to your UI thread yourself.
- Exceptions are contained: an exception in a handler is logged and does not affect the library or other handlers. Exceptions in your own
async voidhandlers cannot be caught by any library; avoid them. DMXReceivedis coalesced per port: at most one event per port is pending, so always read the current data withGetReceivedDMX.- Vetoable events (
ArtAddressReceived,ArtInputReceived,ArtIpProgReceived,RequestRDMMessageReceived) are awaited before the library continues, without blocking the network.
- Choosing interfaces:
ArtNet.Instance.NetworkClientslists one client per local IPv4 address. SetEnabled = falseon interfaces Art-Net should not use. - Sharing the port: several Art-Net applications on the same machine share UDP port 6454. Unicast packets to a shared address can reach only one of them, so other Art-Net software running on the same computer can disturb communication via
127.0.0.1. - Linux and macOS: a socket bound to an interface address does not receive broadcasts there. ArtNetSharp therefore opens an extra receive socket per interface, bound to its broadcast address (#11).
| Packet | Status |
|---|---|
| ArtPoll / ArtPollReply | ✅ incl. targeted mode, reply on change, bind index |
| ArtDmx | ✅ send (unicast to subscribers) and receive (merge per spec) |
| ArtSync | ✅ |
| ArtAddress | ✅ names, Port-Address incl. reset, merge LTP/HTP, cancel merge, LED; other commands reported via event |
| ArtInput | ✅ |
| ArtIpProg / ArtIpProgReply | ✅ reply with current settings; changes via application event |
| ArtDiagData | ✅ |
| ArtData / ArtDataReply | ✅ |
| ArtTimeCode / ArtTimeSync | ✅ send and receive |
| ArtTodRequest / ArtTodControl / ArtTodData | ✅ |
| ArtRdm | ✅ incl. gateway RDM queue (FifoAvail / FifoMax) |
| ArtNzs, ArtVlc, ArtRdmSub | packet classes; received packets reach OnPacketReceived of a derived instance |
| ArtCommand, ArtTrigger, ArtFirmware / ArtFileTn, ArtDirectory | not implemented |
| sACN switching (AcAcnSel) | not supported (Art-Net only) |
- Controller: send DMX to 32 universes
- Node output: receive DMX
- Node input: input DMX into Art-Net
- Node with RDM: RDM devices behind an output node
- Configuration tool: discover devices and watch their ports
ArtNetSharp logs via Microsoft.Extensions.Logging. Hand over your factory once at startup, before the first use of ArtNet.Instance:
ArtNetSharp.Logging.LoggerFactory = yourLoggerFactory;dotnet build
dotnet test ArtNetTests
Most tests run without a network, using an internal loop adapter. A few use 127.0.0.1. If other Art-Net software is running on the same machine and also listens on port 6454, those tests can fail. Tests in the category Hardware need specific devices and are skipped otherwise.
Windows, Linux and macOS.
Contributions are welcome! Please open issues or submit pull requests via GitHub.
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/your-feature) - Open a pull request
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International Public License. See the LICENSE file for details.
ArtNetSharp is developed and maintained by DMXControl Projects e.V..