Skip to content

Magic Packet is send on one NIC #206

Open

Description

@MaciejChalil

We have system with multiple NICs, but WakeOnLAN send Magic Packet only on first NIC. Good feature propably be to select NIC from list to send.

Activity

  1. basildane commented on Aug 14, 2023

    @basildane
    Owner

    I'm not sure what's wrong here.
    In https://github.com/basildane/WakeOnLAN/tree/master/WOL/AquilaWOL.vb line 89

    We send the WOL packet to every network adaptor.
    `
    For Each adapter As NetworkInterface In nics
    ' Only display informatin for interfaces that support IPv4.
    If adapter.Supports(NetworkInterfaceComponent.IPv4) = False Then
    Continue For
    End If

                Dim addresses As UnicastIPAddressInformationCollection = adapter.GetIPProperties.UnicastAddresses
    
                For Each address As UnicastIPAddressInformation In addresses
                    If address.Address.AddressFamily = Net.Sockets.AddressFamily.InterNetwork Then
                        localEndPoint = New IPEndPoint(IPAddress.Parse(address.Address.ToString()), udpPort)
                        Debug.WriteLine("Interface: " & localEndPoint.ToString())
    
                        Try
                            client = New UdpClient()
                            client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, True)
                            client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, True)
                            client.ExclusiveAddressUse = False
                            client.Client.Bind(localEndPoint)
                            client.Connect(network, udpPort)
                            client.EnableBroadcast = True
                            client.Ttl = ttl
    
                            client.Send(packet, packet.Length)
    
                        Catch
    
                        End Try
    
                    End If
                Next
            Next adapter
    

    `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions