hi i tried running the code below as the server:
public static void main(String args[])
{
DatagramSocket socket = new DatagramSocket(); //construct a datagram socket and binds it to the available port and the localhos
byte[] b = new byte[32]; //creates a variable b of type byte
DatagramPacket dgram;
dgram = new DatagramPacket(b, b.length, InetAddress.getByName("235.1.1.1") , 7777);//sends the packet details, length of the packet,destination address and the port number as parameters to the DatagramPacket
//dgram.setData(b);
System.err.println("Sending " + b.length + " bytes to " + dgram.getAddress() + ':' + dgram.getPort());//standard error output stream
while(true) {
System.err.print(".");
socket.send(dgram); //send the datagram packet from this port
Thread.sleep(1000); //cause the current executed thread to sleep for a certain number of miliseconds
}
and client as :
public static void main(String args[]) throws IOException
{
byte[] b = new byte[011];
DatagramPacket dgram = new DatagramPacket(b, b.length);
MulticastSocket socket = new MulticastSocket(7777); // must bind receive side
socket.joinGroup(InetAddress.getByName("235.1.1.1"));
while(true) {
socket.receive(dgram); // blocks until a datagram is received
System.err.println("Received " + dgram.getLength() +
" bytes from " + dgram.getAddress());
dgram.setLength(b.length); // must reset length field!s
}
}
when i run the client it says that " Exception in thread main java.net.SocketException : not a multicast address at java...
"
does anyine knows the reason for this
any comments