[Spread-users] Some basic questions

John Lane Schultz jschultz at spreadconcepts.com
Fri Jun 30 10:58:32 EDT 2006

Bus Mini wrote:
> 1, According to the documentation,  a spread daemon is running in a 
> computer which is using Spread to communicate with other computers. Is 
> this means that if there were 20 computers on the LAN using Spread as a 
> tool to communicate, there must be 20 daemons on runing?

You don't have to run a daemon on each of the twenty machines, but you can do that and if that is the totality of your configuration, then we would actually recommend that you do run a daemon on each machine.

Clients have the ability to connect to Spread daemons on remote machines.  You do this by specifying a daemon name of <port#>@<hostname> on SP_connect.  If all of your client applications and daemons are in the same LAN then running with a daemon on each participating machine will cause the least overhead on your network.  When a client connects remotely to a daemon and it sends or receives a message that message traverses the network multiple times: once from a sending client to the daemon, at least once between the daemons, once to each receiving daemons.

So if you ran your configuration with only a single daemon in the LAN and all clients connecting remotely then each message would go on the network N times where N is the number of receiving clients in the system.  Alternatively, if you ran with a daemon on each participating machine then none of the client-daemon traffic would go on the network it would just go through local IPC or TCP/IP between the client and daemon processes.  So the message would only (normally) be seen on the network one time, between the daemons.

> 2, If the answer of qusetion 1 is YES, then another qusetion posed: 
> according to the API SP_join( mailbox mbox , const char * group ),  a 
> group is built on a daemons, then if a group named "No.1" built on 
> daemon 1, a  group ALSO named " No.1" bulit on another daemon 2 which 
> was running in other computer, deos thses two groups are the same one?

Yes, if the daemons are in the same Spread configuration and can communicate with one another, then clients connecting through different daemons to the same group will perceive each other in the group and see each others' message traffic.

> 3,Some concepts of mailbox. I conside a mailbox as something like a mail 
> box, and a daemon is like a post office, and a group is something like a 
> mailing address, you can have many mailboxs map to an address. If you 
> want to use Spread to communicate with others, you must register a mail 
> first by SP_connect. Then after you got a mailbox, you can use it to 
> send or receive message. And you use SP_join to declare whit which 
> mialbox you  communicate with (send or receive) others. And 
> SP_multicast(mailbox mbox, service service type, const char * 
> group,int16 mess type, int mess len, const char * mess ) is to say with 
> which mailbox you'd like to send message, that means you use this 
> mailbox to send message NOT means you send message to this mailbox. And 
> SP_receive( mailbox mbox, service * service type,char sender[MAX GROUP 
> NAME], int max groups,int * num groups, char groups[][MAX GROUP 
> NAME],int16 * mess type, int * endian mismatch, int max mess len,char * 
> mess ) is to say which mailbox you'd like to check. That means you check 
> this mailbox for a message. Am I right?

Yes, it sounds like you understand the basic architecture.  Your understanding of SP_join sounds a little strange.  I would say SP_join registers your mailbox as a destination mailbox for a given group "address" and SP_leave de-registers your mailbox as a destination mailbox for a given group "address."

Good luck!

John Schultz
Spread Concepts LLC
Phn: 443 838 2200
Fax: 301 560 8875

More information about the Spread-users mailing list