Im pretty new to all this , im trying to get a program working to capture a UDP multicast and write it to a text file . The multicast will be sent over specific port , if i use an application to send directly to my ip it works
but not actually capturing the multicast when just sent out for anyone to pick up .
I cannot change my subnet in program get the following error : java.net.BindException: Cannot assign requested address: Cannot bind
Please see my code below any assistance will be appreciated been battling for weeks now on same problem

import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.io.*; public class UdpReceive { @SuppressWarnings("resource") public static void main(String args[]) throws IOException { //user defines ports System.out.println("please enter listning port "); BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in)); String userPortNumber = bufferedreader.readLine(); int port = Integer.parseInt(userPortNumber); System.out.println ("now listning and writing data to files"); try { //int port = 4050; String subnet = ("0.0.0.0"); // Create a socket to listen on the port DatagramSocket dsocket = new DatagramSocket(port, InetAddress.getByName(subnet)); // Create a buffer to read data into. If a // packet is larger than this buffer, the // excess will simply be discarded! byte[] buffer = new byte[2048]; // Create a packet to receive data into the buffer DatagramPacket packet = new DatagramPacket(buffer, buffer.length); // Now loop forever, waiting to receive packets and printing them. while (true) { // Wait to receive a data dsocket.receive(packet);