Example #1
0
 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 void OnServiceLost(Android.Net.Nsd.NsdServiceInfo service)
 {
 }
 public void OnServiceFound(Android.Net.Nsd.NsdServiceInfo service)
 {
     Logger.Info("Service discovery success" + service);
     mNsdManager.ResolveService(service, new ResolveListener());
 }
Example #4
0
 public void ResolveService(NsdServiceInfo serviceInfo)
 {
     _resolveListener = new ResolveListener();
     _nsdManager.ResolveService(serviceInfo, _resolveListener);
 }
Example #5
0
 public void OnResolveFailed(NsdServiceInfo serviceInfo, NsdFailure errorCode)
 {
     Console.WriteLine("ResolveListener - OnResolveFailed - serviceName: {0} errorCode: {1}", serviceInfo.ServiceName, errorCode.ToString());
 }
Example #6
0
 public void OnServiceResolved(NsdServiceInfo serviceInfo)
 {
     Console.WriteLine("ResolveListener - OnServiceResolved - serviceName: {0}", serviceInfo.ServiceName);
 }
Example #7
0
 public void OnServiceLost(NsdServiceInfo serviceInfo)
 {
     Console.WriteLine("DiscoveryListener - OnServiceLost - serviceName: {0} serviceType: {1} port: {2} hostAddress: {3}", serviceInfo.ServiceName, serviceInfo.ServiceType, serviceInfo.Port, serviceInfo.Host == null ? "null" : serviceInfo.Host.HostAddress);
 }
Example #8
0
 public void OnUnregistrationFailed(NsdServiceInfo serviceInfo, NsdFailure errorCode)
 {
     Console.WriteLine("RegistrationListener - OnUnregistrationFailed - service: {0} error: {1}", serviceInfo.ServiceName, errorCode.ToString());
 }
Example #9
0
 public void OnServiceUnregistered(NsdServiceInfo serviceInfo)
 {
     Console.WriteLine("RegistrationListener - OnServiceUnregistered - service: {0}", serviceInfo.ServiceName);
 }