private async void UpnpClient_OnDeviceFound(object Sender, DeviceLocationEventArgs e) { try { lock (this.ipAddressesFound) { if (this.ipAddressesFound.ContainsKey(e.RemoteEndPoint.Address)) { return; } this.ipAddressesFound[e.RemoteEndPoint.Address] = true; } DeviceDescriptionDocument Doc = await e.Location.GetDeviceAsync(); if (Doc != null) { UPnPService Service = Doc.GetService("urn:schemas-upnp-org:service:WANIPConnection:1"); if (Service == null) { Service = Doc.GetService("urn:schemas-upnp-org:service:WANIPConnection:2"); if (Service == null) { return; } } ServiceDescriptionDocument Scpd = await Service.GetServiceAsync(); this.ServiceRetrieved(Scpd, e.LocalEndPoint); } } catch (Exception ex) { this.exception = ex; this.State = PeerToPeerNetworkState.Error; } }