Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@praveenkumar-66Ze92 • May 15, 2011
Please explain the problem fully. Multicasting, you say, but its actually Typecasting...
-
@umaragavan21-Fy1jWo • May 15, 2011
i have to implement this model
which has one administrator for the whole group and sub group leader for each subgroup.The administrator sends a message to each sub group leader and the subgroup leaders send that message to their group members. -
@praveenkumar-66Ze92 • May 15, 2011
Unable to open the image or the link you have specified man!
-
@umaragavan21-Fy1jWo • May 15, 2011
#-Link-Snipped-#
please have a look at this link. The paper is PLEASE, âPâ-LEAder SElection for Multicast Group Communication -
@praveenkumar-66Ze92 • May 15, 2011
Sure... 😀 Will help ya out!!! 😀
-
@umaragavan21-Fy1jWo • May 15, 2011
thank u so much
-
@praveenkumar-66Ze92 • May 15, 2011
Hey, this is Multicast Networking... You heard of broadcast and telecast right? The same way this works. And for Java, what are you trying to do, the same project or you have any other idea? Like sending a bulk SMS to many? 😉
-
@praveenkumar-66Ze92 • May 15, 2011
Check this out... For developers they have given a tutorial on how to multicast using Java... 😀
#-Link-Snipped-# 😀 -
@umaragavan21-Fy1jWo • May 15, 2011
i m going to implement the same project
-
@umaragavan21-Fy1jWo • May 15, 2011
this code is not working
-
@praveenkumar-66Ze92 • May 15, 2011
Can you post the code?
-
@umaragavan21-Fy1jWo • May 15, 2011
import java.io.*;
import java.net.*;
import java.util.*;
public class MulticastClient {
public static void main(String[] args) throws IOException {
MulticastSocket socket = new MulticastSocket(4446);
InetAddress address = InetAddress.getByName("230.0.0.1");
socket.joinGroup(address);
DatagramPacket packet;
// get a few quotes
for (int i = 0; i < 5; i++) {
byte[] buf = new byte[256];
packet = new DatagramPacket(buf, buf.length);
socket.receive(packet);
String received = new String(packet.getData(), 0, packet.getLength());
System.out.println("Quote of the Moment: " + received);
}
socket.leaveGroup(address);
socket.close();
}
} -
@umaragavan21-Fy1jWo • May 15, 2011
import java.io.*;
import java.net.*;
import java.util.*;
public class MulticastServerThread extends QuoteServerThread {
private long FIVE_SECONDS = 5000;
public MulticastServerThread() throws IOException {
super("MulticastServerThread");
}
public void run() {
while (moreQuotes) {
try {
byte[] buf = new byte[256];
// construct quote
String dString = null;
if (in == null)
dString = new Date().toString();
else
dString = getNextQuote();
buf = dString.getBytes();
// send it
InetAddress group = InetAddress.getByName("230.0.0.1");
DatagramPacket packet = new DatagramPacket(buf, buf.length, group, 4446);
socket.send(packet);
// sleep for a while
try {
sleep((long)(Math.random() * FIVE_SECONDS));
} catch (InterruptedException e) { }
} catch (IOException e) {
e.printStackTrace();
moreQuotes = false;
}
}
socket.close();
}
} -
@umaragavan21-Fy1jWo • May 15, 2011
public class MulticastServer {
public static void main(String[] args) throws java.io.IOException {
new MulticastServerThread().start();
}
} -
@praveenkumar-66Ze92 • May 15, 2011
Error log please...
-
@praveenkumar-66Ze92 • May 15, 2011
Did you include the MulticastServer class first???
-
@umaragavan21-Fy1jWo • May 16, 2011
ya i included.
-
@praveenkumar-66Ze92 • May 16, 2011
Oki, send the error log here... Please wrap it up in code tags... 😀
-
@umaragavan21-Fy1jWo • May 16, 2011
praveenscienceOki, send the error log here... Please wrap it up in code tags... 😀[/QUOTE
i getting error in MulticastServer
" cant find symbol public class MulticastServerThread extends QuoteServerThread"' -
@praveenkumar-66Ze92 • May 16, 2011
Dude, that's what I said, you haven't included the class MulticastServerThread correctly!!! Include it and it works... 😀
-
@umaragavan21-Fy1jWo • May 16, 2011
ya now it works without error but when i run MulticastServer i am getting an error couldnot open quote file.Serving time instead
-
@praveenkumar-66Ze92 • May 16, 2011
Woah.. Congrats,., 😀