Code example for MulticastSocket

Methods: send

0
	} 
	 
	public static void sendDiscover() { 
		Log.d(TAG, "sendDiscover()");
		try { 
			MulticastSocket soc = new MulticastSocket(DEFAULT_PORT);
			byte[] buf = DISCOVER_MESSAGE.getBytes();
			DatagramPacket packet = new DatagramPacket(buf, buf.length, InetAddress.getByName(MULTICAST_ADDRESS), DEFAULT_PORT);
			soc.send(packet);
		} catch (IOException e) {
			e.printStackTrace();
		} 
    } 
	 
	public static void receiver() { 
		Log.d(TAG, "receiver()");
		try { 
			WifiManager manager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
			MulticastLock lock = manager.createMulticastLock("lock name");
			lock.setReferenceCounted(true);
Connect your IDE to all the code out there  Get Codota for Java