[Spread-users] Getting started with spread

Jonathan Stanton jonathan at cnds.jhu.edu
Thu Feb 14 00:47:44 EST 2008


If you want to receive the messages you send, you will need a program (maybe the same one) 
that joins the group and then receives messages sent to it using either the 'receive' 
method or by creating a listener thread. 

The best example would be to look at the User.java sample program in the Spread source 
distribution. It can send messages to groups and will receive and print with formatting 
both data and membership messages that are received. 

Cheers,

Jonathan

On Mon, Feb 11, 2008 at 01:30:32AM -0500, Rodrick Brown wrote:
> Hello all I'm very new to spread actually came across it today and wanted to
> get a feel for it.
> I'm using the java API and having a bit of trouble connecting to my spread
> daemon and sending basic multicast messages.
> >From my understanding the messages should be sent to stdout this does not
> happen and i'm not seeing any received packets from spmonitor
> 
> Here is my simple test code.
> 
> [rbrown at macbookpro:/opt/spread/etc] $ egrep '^[^#]' spread.conf
> Spread_Segment  127.0.0.255:4803 {
>         localhost               127.0.0.1
> }
> 
> My java code.
> public class SpreadExample   {
>     public static void main(String[] args) throws IOException,
> SpreadException {
>         SpreadVersion ver = new SpreadVersion();
>         SpreadMessage msg = new SpreadMessage();
>         SpreadGroup group = new SpreadGroup();
>         byte[] data = new byte[] {'h','e','l','l','o'};
> 
>         SpreadConnection connection = new SpreadConnection();
>         InetAddress spreadhost = InetAddress.getByName("localhost");
>         connection.connect(spreadhost,4803,"group",false,false);
>         group.join(connection,"Agroup");
>         msg.setData(data);
>         msg.addGroup("Agroup");
>         connection.multicast(msg);
>     }
> }
> 
> Thanks.
> 
> -- 
> Rodrick R. Brown
> http://www.rodrickbrown.com

> _______________________________________________
> Spread-users mailing list
> Spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users


-- 
-------------------------------------------------------
Jonathan R. Stanton         jonathan at cs.jhu.edu
Dept. of Computer Science   
Johns Hopkins University    
-------------------------------------------------------




More information about the Spread-users mailing list