Author: jfrederic.clere(a)jboss.com
Date: 2008-06-11 10:15:14 -0400 (Wed, 11 Jun 2008)
New Revision: 1692
Added:
trunk/mod_cluster/test/java/Advertize.java
Log:
Add a test for advertise.
Added: trunk/mod_cluster/test/java/Advertize.java
===================================================================
--- trunk/mod_cluster/test/java/Advertize.java (rev 0)
+++ trunk/mod_cluster/test/java/Advertize.java 2008-06-11 14:15:14 UTC (rev 1692)
@@ -0,0 +1,19 @@
+import java.net.MulticastSocket;
+import java.net.InetAddress;
+import java.net.DatagramPacket;
+
+public class Advertize
+{
+ public static void main(String[] args) throws Exception
+ {
+ InetAddress group = InetAddress.getByName("228.5.6.7");
+ MulticastSocket s = new MulticastSocket(23364);
+ s.joinGroup(group);
+ byte[] buf = new byte[1000];
+ DatagramPacket recv = new DatagramPacket(buf, buf.length);
+ s.receive(recv);
+ String data = new String(buf);
+ System.out.println("received: " + data);
+ s.leaveGroup(group);
+ }
+}
Show replies by date