mdns.AnswerReceived += (s, e) =>
{
// Is this an answer to a service instance details?
var servers = e.Message.Answers.OfType<SRVRecord>();
foreach (var server in servers)
{
Console.WriteLine($"host '{server.Target}' for '{server.Name}'");
// Ask for the host IP addresses.
mdns.SendQuery(server.Target, type: DnsType.A);
mdns.SendQuery(server.Target, type: DnsType.AAAA);
}
// Is this an answer to host addresses?
var addresses = e.Message.Answers.OfType<AddressRecord>();
foreach (var address in addresses)
{
Console.WriteLine($"host '{address.Name}' at {address.Address}");
}
};
I cannot get the address most of time, I can only get the server.Name.
I need to call sd.QueryServiceInstances(mServiceType); many times, I finally can get address.
In your example code,
I cannot get the address most of time, I can only get the server.Name. I need to call
sd.QueryServiceInstances(mServiceType);
many times, I finally can get address.Is any thing I need to do? Thanks.