private void SetupNsd() { string serviceName = string.Empty; NsdServiceInfo serviceInfo = new NsdServiceInfo(); serviceInfo.ServiceName = "SessionsDiscoveryService"; serviceInfo.ServiceType = "_http._tcp."; serviceInfo.Port = 53552; _nsdManager = (NsdManager)SessionsApplication.Context.GetSystemService(Context.NsdService); _discoveryListener = new DiscoveryListener(_nsdManager); _registrationListener = new RegistrationListener(); _registrationListener.ServiceRegistered += delegate(NsdServiceInfo info) { serviceName = info.ServiceName; }; _nsdManager.RegisterService(serviceInfo, NsdProtocol.DnsSd, _registrationListener); }
public DiscoveryListener(NsdManager nsdManager) { _nsdManager = nsdManager; }