0

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?

3
  • 1
    Did you try this answer. It uses BroadCastAddress
    – Eldar
    Commented Oct 17, 2022 at 11:24
  • @Eldar That seems to work! A much simpler way of doing things. Would you like to submit that as an answer?
    – Daveoc64
    Commented Oct 17, 2022 at 12:39
  • That would be a duplicate I think, but glad to help.
    – Eldar
    Commented Oct 17, 2022 at 13:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.