Esempio n. 1
0
 private void unListenService(String type, boolean notify) {
   if (null != mDiscoverListener && notify) {
     mDiscoverListener.onDiscoverStopped(type);
   }
   if (null != mJmDNS) {
     mJmDNS.removeServiceListener(mType, mJmDNSListener);
   }
 }
Esempio n. 2
0
 private void stopMDNS() throws IOException {
   if (jmdns != null) {
     for (JmDNS mdns : jmdns) {
       if (mdns == null) {
         continue;
       }
       Log.i(TAG, "Stopping GameClient discovery " + mdns.getName());
       mdns.removeServiceListener(SERVICE_TYPE, GameClient.this);
       mdns.close();
       mdns = null;
     }
   }
 }
Esempio n. 3
0
 private void destroyService(ZeroServiceInfo zsi, boolean notify) {
   if (null == mJmDNS) {
     if (notify) {
       mServiceListener.onServiceUnregistered(zsi);
     }
     return;
   }
   try {
     releaseMulticastLock();
     mJmDNS.removeServiceListener(mType, mJmDNSListener);
     mJmDNS.unregisterAllServices();
     mJmDNS.close();
     mJmDNS = null;
     if (null != mServiceListener && notify) {
       mServiceListener.onServiceUnregistered(zsi);
     }
   } catch (Exception e) {
     Log.e(TAG, "failed to close the JmDNS service");
     if (null != mServiceListener && notify) {
       mServiceListener.onServiceUnregisteredFailed(zsi);
     }
   }
 }