MagicPacket 1.1.5

.NET 6.0
NuGet\Install-Package MagicPacket -Version 1.1.5
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.
dotnet add package MagicPacket --version 1.1.5
<PackageReference Include="MagicPacket" Version="1.1.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MagicPacket --version 1.1.5
#r "nuget: MagicPacket, 1.1.5"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install MagicPacket as a Cake Addin
#addin nuget:?package=MagicPacket&version=1.1.5

// Install MagicPacket as a Cake Tool
#tool nuget:?package=MagicPacket&version=1.1.5

Logo Magic Packet

NuGet version (MagicPacket)
Continuous Integration

A cross-platform, light-weight implementation of the Magic Packet -- most commonly known for its use in Wake-on-LAN.

How to Use

The simplest way to use this library is:

using MagicPacketClient client = new();
string target = "00:00:00:00:00:00"; // The MAC address of the target device
await client.BroadcastOnAllInterfacesAsync(target);

Please take a look at the example implementation source code or you may want the ready-to-go cross-platform portable binaries.

  • Supports use of Secure-On passwords.
  • Supports multiple network interfaces**.
  • Supports targeting machines on remote networks (explicity define the broadcast address).
  • Broadcasts on the following ports:
    • Reserved Port Number (Port 0)
    • Echo Protocol (Port 7)
    • Discard Protocol (Port 9)

**Note: The default behavior is to broadcast on every network interface, to change this, explicity define the broadcast endpoint in the configuration file or as an input argument when running the application.

Known Limitations
  • The current release does not send using EtherType 0x0842.
  • Networks that exclusively use IPv6 only, are supported, but require manual definition of the broadcast address, as the automated broadcast address discovery function requires IPv4 to work.

Standards and References

This implementation follows the specifications outlined in the Magic Packet Technology, Whitepaper which was originally proposed by AMD and Hewlett Packard back in 1995.

In addition to following the specification, the program also has support for Secure-On passwords (which was added later). Another good resource published by Texas Instruments covers the entire specification and was also referenced.

What is Wake-on-LAN?

Wake-on-LAN (WOL) is an Ethernet or Token Ring computer networking standard that allows a computer to be turned on or awakened by a network message.

The message is usually sent to the target computer by a program executed on a device connected to the same local area network. It is also possible to initiate the message from another network by using subnet directed broadcasts or a WoL gateway service.

Equivalent terms include wake on WAN, remote wake-up, power on by LAN, power up by LAN, resume by LAN, resume on LAN and wake up on LAN.

What is a Magic Packet?

The magic packet is a frame that is most often sent as a broadcast and that contains anywhere within its payload 6 bytes of all 255 (e.g., FF FF FF FF FF FF in hexadecimal), followed by 16 repetitions of the target computer's 48-bit MAC address, for a total of 102 bytes.

Since the magic packet is only scanned for the string above, and not actually parsed by a full protocol stack, it could be sent as payload of any network- and transport-layer protocol, although it is typically sent as a UDP datagram to port 0 (reserved port number), 7 (Echo Protocol) or 9 (Discard Protocol), or directly over Ethernet as EtherType 0x0842.

A connection-oriented transport-layer protocol like TCP is less suited for this task as it requires establishing an active connection before sending user data.

A standard magic packet has the following basic limitations:

  • Requires destination computer MAC address (also may require a Secure-On password).
  • Does not provide a delivery confirmation.
  • May not work outside of the local network.
  • Requires hardware support of Wake-on-LAN on destination machine.
  • Most 802.11 wireless interfaces do not maintain a link in low power states and cannot receive a magic packet.

The Wake-on-LAN implementation is designed to be very simple and to be quickly processed by the circuitry present on the network interface card with minimal power requirement. Because Wake-on-LAN operates below the IP protocol layer, IP addresses and DNS names are meaningless and so the MAC address is required.

Product Versions
.NET net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.5 93 7/8/2022
1.1.4 70 7/7/2022
1.1.3 62 7/7/2022
1.1.2 75 7/7/2022
1.1.1 83 7/7/2022
1.1.0 78 7/7/2022