Example #1
0
        /// <summary>
        /// Registers a multicast address as a receiver address on the given interface
        /// </summary>
        /// <param name="name">The name of the interface</param>
        /// <param name="address">The address to register with the interface</param>
        public void RegisterMacOnInterface(string name, PhysicalAddress address)
        {
            var req = new InterfaceRequestMac();

            req.Name = name;
            req.ifru_hwaddr.MacAddress = address;

            var result = ioctl(SocketHandle, (int)ESocketIOCTL.ADDMULTI, ref req);

            if (result < 0)
            {
                throw new Exception("Error registering multicast MAC address to listen to on the interface " + name);
            }

            //Console.WriteLine("ioctl called " + result.ToString());
        }
Example #2
0
 private static extern int ioctl(int d, int request, ref InterfaceRequestMac macRequest);