public void Start(IPAddress ipAddress, string replyIP) { UDPListener listener = new UDPListener(AddressFamily.InterNetwork); IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, 137); listener.Client.Bind(ipEndPoint); while (true) { try { byte[] receiveBuffer = listener.Receive(ref ipEndPoint); ProcessRequest(receiveBuffer, listener, ipEndPoint, replyIP); } 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); } } }