I am trying to build an application in .NET 6 that can send wake-on-LAN magic packets.
I'm following this answer on Stack Overflow to implement this: https://stackoverflow.com/a/58043033/1992818
This works great on Windows, but doesn't work on Ubuntu, because the IPInterfaceProperties.MulticastAddresses property is empty.
The basic code is the following:
foreach (NetworkInterface networkInterface in NetworkInterface.GetAllNetworkInterfaces())
{
IPInterfaceProperties iPInterfaceProperties = networkInterface.GetIPProperties();
// count will always be 0
int count = iPInterfaceProperties.MulticastAddresses.Count;
}
Is there a different way to get this working on Ubuntu from .NET?
BroadCastAddress