-
Notifications
You must be signed in to change notification settings - Fork 66
Closed
Description
I have read the FAQ and applied these two answers:
I get notifications but no search results, why?
I don't get search results or notifications?
My code is simple:
private SsdpDeviceLocator _DeviceLocator;
private static List<SsdpDevice> DeviceLst { get; set; }
// Call this method from somewhere in your code to start the search.
public void BeginSearch() {
DeviceLst = new List<SsdpDevice>();
IPAddress localNetwork = Dns.GetHostAddresses(Dns.GetHostName())
.Where(ia => (ia.AddressFamily == AddressFamily.InterNetwork)).First();
Rssdp.Infrastructure.SsdpCommunicationsServer localPortServer =
new Rssdp.Infrastructure.SsdpCommunicationsServer(new Rssdp.SocketFactory(localNetwork.ToString()), 60000);
_DeviceLocator = new SsdpDeviceLocator(localPortServer);
// (Optional) Set the filter so we only see notifications for devices we care about
// (can be any search target value i.e device type, uuid value etc - any value that appears in the
// DiscoverdSsdpDevice.NotificationType property or that is used with the searchTarget parameter of the Search method).
//_DeviceLocator.NotificationFilter = "upnp:rootdevice";
_DeviceLocator.DeviceAvailable += deviceLocator_DeviceAvailable;
_DeviceLocator.StartListeningForNotifications();
_DeviceLocator.SearchAsync();
}
public void PauseSearch() {
_DeviceLocator.StopListeningForNotifications();
_DeviceLocator.Dispose();
_DeviceLocator = null;
}
async static void deviceLocator_DeviceAvailable(object sender, DeviceAvailableEventArgs e) {
var fullDevice = await e.DiscoveredDevice.GetDeviceInfo();
lock(DeviceLst) {
if(!DeviceLst.Any(c => c.Uuid == fullDevice.Uuid)) {
DeviceLst.Add(fullDevice);
(Application.Current as App).DeviceListView.ItemsSource = DeviceLst;
}
}
}
I can see the device in Device Spy, and I can see both M-SEARCH and NOTIFY messages in Device Sniffer.
Device and phone are on the same subnet.
My only clue is that the Galaxy S9 test device does not find any UPnP devices on the network using SSDPTester app.
Is there a setting on the phone that is keeping DeviceLocator from receiving UDP traffic?
Metadata
Metadata
Assignees
Labels
No labels