[Spread-users] spread Communication Protocol

Bill Noon noon at snow.nrcc.cornell.edu
Wed Apr 9 08:42:57 EDT 2008

On Apr 9, 2008, at 3:21 AM, wglin122 wrote:

> hi:
> I am a green hand of spread and now learning spread Communication  
> Protocol
> I'm writing a spread client by python which is try to connect to the
> spread server.
> Now I have several problems of Spread communication with python.Please
> help me to make the connect protocol right.
> Thanks a lot!

Unless you are trying to learn about the Spread protocol  
implementation, it is much easier to use the standard python wrappers.

For spread version 3.17.3: http://zope.org/Members/tim_one/spread

For spread version 4, I have provided a patch to the above code in  
the following mailing list post:

I don't know if Tim Peters is still interested in hosting the  
wrapper, but I would favor consolidating the code and putting it on  
one site linked from spread.org (the current link is out of date).

With the python wrapper, you have access to a high level interface:

import spread
mbox = spread.connect('5555 at')
print mbox.private_group
mbox.multicast(spread.AGREED_MESS,'purge_gz','test message', 1)

# the following will block until a message arrives
msg = mbox.receive()

# there will be several messages including the one sent above

print msg.group      # group message sent to
print msg.members    # list of members who received the message
print msg.message    # string buffer of the contents of the message  
('test message') above
print msg.msg_type   # 1 in the above case


Hope that helps.

--Bill Noon
Northeast Regional Climate Center
Cornell University

More information about the Spread-users mailing list