need code for multicasting in java
multicasting in java, which contains a single administrator and and a single leader for each sub group
Replies
-
PraveenKumar PurushothamanPlease explain the problem fully. Multicasting, you say, but its actually Typecasting...
-
umaragavan21
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 PurushothamanUnable to open the image or the link you have specified man!
-
umaragavan21#-Link-Snipped-#
please have a look at this link. The paper is PLEASE, รขPรข-LEAder SElection for Multicast Group Communication -
PraveenKumar PurushothamanSure... ๐ Will help ya out!!! ๐
-
umaragavan21thank u so much
-
PraveenKumar PurushothamanHey, 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 PurushothamanCheck this out... For developers they have given a tutorial on how to multicast using Java... ๐
#-Link-Snipped-# ๐ -
umaragavan21i m going to implement the same project
-
umaragavan21this code is not working
-
PraveenKumar PurushothamanCan you post the code?
-
umaragavan21import 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();
}
} -
umaragavan21import 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();
}
} -
umaragavan21public class MulticastServer {
public static void main(String[] args) throws java.io.IOException {
new MulticastServerThread().start();
}
} -
PraveenKumar PurushothamanError log please...
-
PraveenKumar PurushothamanDid you include the MulticastServer class first???
-
umaragavan21ya i included.
-
PraveenKumar PurushothamanOki, send the error log here... Please wrap it up in code tags... ๐
-
umaragavan21praveenscienceOki, 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 PurushothamanDude, that's what I said, you haven't included the class MulticastServerThread correctly!!! Include it and it works... ๐
-
umaragavan21ya now it works without error but when i run MulticastServer i am getting an error couldnot open quote file.Serving time instead
-
PraveenKumar PurushothamanWoah.. Congrats,., ๐
You are reading an archived discussion.
Related Posts
Hi sir, i have passed my SSC examination this year and i want to do diploma in chemical engineering.So what can i do for it? and will you elaberate scope...
I'm a student at NMIMS University Mumbai, pursuing MBATECH(IT), in the Fourth Year Click Here
I want to make a career as a business analyst in the tablet & smartphone...
hello every member ,
i am a newbie to CE just about to complete B.Tech. in EC from Nirma University ahmedabad..born and brought up in mathura..placed in infosys and cognizant..gotta...
Hello All,
Here we are again with the latest issue of ClubHack Magazine. This time also the issue is dedicated to Browser security.
ClubHack Magazine:
Direct Download:
Tech Gyan -...
Friends,
I have a little doubt. Now to be frank, My aggregate percentage is coming out to be 65%. I have completed III year mechanical engineering. I have one year...