Code example for MulticastSocket

Methods: joinGroup, setReuseAddress

0
	  public void init () 
	  { 
		    mBroadcastAddress = MULTICAST_ADDRESS ;
			 
			try { 
				socket = new MulticastSocket();
				 
				socket.setReuseAddress(true);
				socket.joinGroup(mBroadcastAddress);
		     
				SEARCH_TEAMPLTE = 
				        "M-SEARCH * HTTP/1.1\r\n" + 
						"HOST: " + mBroadcastAddress.getHostAddress() + ":55000\r\n" +
				        "MAN: \"ssdp:discover\"\r\n" +  
				        "USER-AGENT: " + System.getProperty("os.name") + "/" + System.getProperty("os.version") + " UPnP/1.1 GooMoo Remote\r\n" +
				        "ST: %s\r\n" +  
				        "MX: %d\r\n" + 
				        "\r\n"; 
			}catch (IOException e) {
				Toast.makeText(context, "DeviceFinder::DeviceFinder " + e.toString(), 
						Toast.LENGTH_LONG).show() ;