I can correctly register the DNS-SD service, but I cannot unregister the DNS-SD service from the local network. I tried to use the method Dispose()to close StreamSocketListener, but it does not work.
Below is the code for the service registration method. Anyone can help me remove the service from the local network.
private async void RegisterService()
{
listener = new StreamSocketListener();
await listener.BindServiceNameAsync("");
listenServ = new DnssdServiceInstance("service._type._tcp.local", null, 211);
try
{
var result = await listenServ.RegisterStreamSocketListenerAsync(listener);
}
catch (Exception exp)
{
}
}
source
share