diff --git a/Spike/Program.cs b/Spike/Program.cs
index 219c1d4..05804c3 100644
--- a/Spike/Program.cs
+++ b/Spike/Program.cs
@@ -51,13 +51,14 @@ static void Main(string[] args)
}
};
+#if false
var sd = new ServiceDiscovery(mdns);
sd.Advertise(new ServiceProfile("x1", "_xservice._tcp", 5011));
sd.Advertise(new ServiceProfile("x2", "_xservice._tcp", 666));
var z1 = new ServiceProfile("z1", "_zservice._udp", 5012);
z1.AddProperty("foo", "bar");
sd.Advertise(z1);
-
+#endif
mdns.Start();
Console.ReadKey();
}
diff --git a/src/MessageEventArgs.cs b/src/MessageEventArgs.cs
index 9aaba5c..c9e5c54 100644
--- a/src/MessageEventArgs.cs
+++ b/src/MessageEventArgs.cs
@@ -24,6 +24,14 @@ public class MessageEventArgs : EventArgs
/// The endpoint from the message was received.
///
public IPEndPoint RemoteEndPoint { get; set; }
+
+ ///
+ /// Determines if the sender is using legacy unicast DNS.
+ ///
+ ///
+ /// false if the sender is using port 5353.
+ ///
+ public bool IsLegacyUnicast => RemoteEndPoint.Port != MulticastClient.MulticastPort;
}
}
diff --git a/src/MulticastClient.cs b/src/MulticastClient.cs
index 5856232..4af58ac 100644
--- a/src/MulticastClient.cs
+++ b/src/MulticastClient.cs
@@ -19,7 +19,14 @@ class MulticastClient : IDisposable
{
static readonly ILog log = LogManager.GetLogger(typeof(MulticastClient));
- const int MulticastPort = 5353;
+ ///
+ /// The port number assigned to Multicast DNS.
+ ///
+ ///
+ /// Port number 5353.
+ ///
+ public static readonly int MulticastPort = 5353;
+
static readonly IPAddress MulticastAddressIp4 = IPAddress.Parse("224.0.0.251");
static readonly IPAddress MulticastAddressIp6 = IPAddress.Parse("FF02::FB");
static readonly IPEndPoint MdnsEndpointIp6 = new IPEndPoint(MulticastAddressIp6, MulticastPort);
diff --git a/test/MulticastServiceTest.cs b/test/MulticastServiceTest.cs
index 254c77e..4560f13 100644
--- a/test/MulticastServiceTest.cs
+++ b/test/MulticastServiceTest.cs
@@ -40,8 +40,12 @@ public void SendQuery()
mdns.NetworkInterfaceDiscovered += (s, e) => ready.Set();
mdns.QueryReceived += (s, e) =>
{
- msg = e.Message;
- done.Set();
+ if ("some-service.local" == e.Message.Questions.First().Name)
+ {
+ msg = e.Message;
+ Assert.IsFalse(e.IsLegacyUnicast);
+ done.Set();
+ }
};
try
{