title: How to start 2 services at different ports using jmdns?
body: <p>I need to start 2 services simultaneously (i.e airplay and airtunes) using jmdns. I'm able to start one service using jmdns but when I register 2 services simultaneously it gives me exception while sending data from IOS.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>void startDNSService() {
  
      final JmDNS jmDNS = JmDNS.create(address); /* Create mDNS responder for address */
      s_jmDNSInstances.add(jmDNS);
      jmDNS.registerServiceType(AIR_TUNES_SERVICE_TYPE); /* Initialization service name */
  
      String name = Utils.servName.length() &gt; 0 ? Utils.servName : Utils.HardwareAddressString + "@X" + android.os.Build.MODEL;
      Utils.servName = name;
      /* Publish RAOP service */
      final ServiceInfo airPlayServiceInfo = ServiceInfo.create(
                                                                AirPlayConstant.type,name, /* Service Name */
                                                                AirPlayConstant.port, 0 /* weight */, 0 /* priority */,
                                                                AirPlayConstant.getTxtHead());
      jmDNS.registerService(airPlayServiceInfo);
  
      final JmDNS     jmDNS = JmDNS.create(InetAddress.getByName(ip),"audio");//AirTunes Service Strart code:
  
      jmDNSInstances.add(jmDNS);//   Create mDNS responder for address
      jmDNS.registerServiceType(AirPlayConstant.type);
      //   Publish RAOP service
      final ServiceInfo airTunesServiceInfo = ServiceInfo.create(AIR_TUNES_SERVICE_TYPE, "Airplay", getRtspPort(), 0 , 0 ,
                                                                 AIRTUNES_SERVICE_PROPERTIES);
  
      jmDNS.registerService(airTunesServiceInfo);
  
  }
  </code></pre>
  
  <p>I've got <code>ChannelCloseException</code> while sharing audio from iTunes through AirTunes service. Video works well.</p>