[Spread-users] How to find out the Group of the Message, in which the Message was send.

John Schultz jschultz at spreadconcepts.com
Mon Nov 8 14:51:57 EST 2010

Quoting from http://www.spread.org/docs/spread_docs_4/docs/sp_receive.html

If the service_type is a REG_MESSAGE (i.e. data message) then:

The sender is a pointer to an array of characters of at least MAX_GROUP_NAME size. This will be set to the name of the sending connection (its private group name) ...

The groups array holds upto max_groups group names, each of which is a string of at most MAX_GROUP_NAME characters. All of the groups which are receiving this message will be listed here, unless the array is too small and then as many as can fit will be listed and the num_groups value will be set to be negative. For example, if your groups array could store 5 group names, but a message for 7 groups arrived, the first five group names would appear in the groups array and num_groups would be set to -7.


If This is a MEMB_MESSAGE (i.e. membership message) and it specifically is a REG_MEMB_MESS, then:

The sender char array will be set to the name of the group for which the membership change is occurring ...

The groups array and mess body are used to provide two kinds of membership information about the change that just occurred in this group. The num_groups field will be set to the number of members in the group in the new membership (i.e. after the change occurred). Correspondingly the groups array will be set to the private group names of all members of this group in the new membership. This list of names is always in the same order at all recipients and thus can be used to deterministically pick a group representative if one is needed by the application. The actual ordering has changed with different versions of Spread, but is currently ordered first by the daemon the member is connected to and then by their private name. The ordering of the daemons is the same as the order they are listed in the spread.conf file.


You seem to be confusing the "sender" parameter (#2) with the "groups" parameter (#6) for various kinds of messages.


John Lane Schultz
Spread Concepts LLC
Phn: 301 830 8100
Cell: 443 838 2200

On Nov 8, 2010, at 2:10 PM, Claus Ebert wrote:


Thanks for your response.

Unfortunately, the groups parameter #6 of SP_receive get's the Group
name only
on a REG_MEMB_MESS messages. 
When sending a AGREED_MESS REGULAR_MESS this list is filled with the
Private_name used in SP_connect (#2) and the segment name as defined in
Config-file (e.G: privateName#segmentName) and not the Group-Name.

I logged the output of the spuer prog... On the bottom in the line
----received AGREED message from #13864#xts01, of type 123, (endian 0)
to 1 groups
You see the private_name and the segment, but not the group I joined


------- spuser log ------------------------------------------------

$ ./spuser
Spread library version is 4.1.0
User: connected to 4803 at localhost with private group #user#xts02

User Menu:

       j <group> -- join a group
       l <group> -- leave a group

       s <group> -- send a message
       m <group> -- send a multiline message to group. Terminate with
empty line
       b <group> -- send a burst of messages

       r -- receive a message (stuck)
       p -- poll for a message
       e -- enable asynchonous read (default)
       d -- disable asynchronous read

       q -- quit

User> j TestGroup

Received REGULAR membership for group TestGroup with 2 members, where I
am member 1:
grp id is -1408177919 1289242281 4
Due to the JOIN of #user#xts02

received AGREED message from #13864#xts01, of type 123, (endian 0) to 1
(106 bytes): Message -


-----Original Message-----
From: John Schultz [mailto:jschultz at spreadconcepts.com] 
Sent: Montag, 8. November 2010 16:47
To: Claus Ebert
Cc: spread-users at lists.spread.org
Subject: Re: [Spread-users] How to find out the Group of the Message, in
which the Message was send.



The answer is in the groups parameter (#6).


John Lane Schultz
Spread Concepts LLC
Phn: 301 830 8100
Cell: 443 838 2200

On Nov 8, 2010, at 4:29 AM, Claus Ebert wrote:

Hi all,

I'm currently looking for a way to get the sending group of a message (
using the SP_receive function ).
.. i'm NOT looking for the sender .. i'm keen on getting the group to
which the massage uas sent (SP_multicast, param no 3 )


sender (s1#spread)           receiver(r1#spread)
connect to spread
joins group G1
                            connect to spread
                            joins group G1
sends message                receives message but "group" is s1#spread
and NOT G1 

sorry, if the question was already answered in the archive, but due to
proxy restrictions, i'm not able to access the mail archive page.


Spread-users mailing list
Spread-users at lists.spread.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3805 bytes
Desc: not available
Url : http://lists.spread.org/pipermail/spread-users/attachments/20101108/2ea5bf3d/attachment.bin 

More information about the Spread-users mailing list