public new void Start(IPAddress ipAddress, string replyIP, string replyIPv6) { UDPListener listener = new UDPListener(AddressFamily.InterNetwork); IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, 5353); if (string.Equals(ipAddress.AddressFamily.ToString(), "InterNetwork")) { listener.JoinMulticastGroup(IPAddress.Parse("224.0.0.251"), ipAddress); } else { listener = new UDPListener(AddressFamily.InterNetworkV6); listener.JoinMulticastGroup(IPAddress.Parse("ff02::fb")); } listener.Client.Bind(ipEndPoint); while (true) { try { byte[] receiveBuffer = listener.Receive(ref ipEndPoint); ProcessRequest(receiveBuffer, listener, ipEndPoint, replyIP, replyIPv6); } catch (Exception ex) { OutputError(ex); } } }
public void Start(IPAddress ipAddress, string mac, string dnsIPv6) { UDPListener listener = new UDPListener(AddressFamily.InterNetworkV6); IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, 547); listener.JoinMulticastGroup(IPAddress.Parse("ff02::1:2")); listener.Client.Bind(ipEndPoint); while (true) { try { byte[] receiveBuffer = listener.Receive(ref ipEndPoint); ProcessRequest(receiveBuffer, listener, ipEndPoint, mac, dnsIPv6); } catch (Exception ex) { Console.WriteLine(ex); } } }