[Spread-users] Spread Questions: Asynchronous/Receive with timeout

Serge Aleynikov serge at hq.idt.net
Sun May 8 21:23:08 EDT 2005



Li, Grant wrote:

> Hi,
>  
> I'm pretty new to Spread, so please bear with me if my questions are 
> very basic:
>  
> 1) Does Spread support asynchronous communications? I ran the sample 
> program flooder.c with -wo and -ro flags. It seems like 
> that messages are disappeared if messages are sent by a sender while a 
> receiver is not running.

You need to have an active recipient process in order to ensure delivery 
of messages - spread is not a queuing system.

> 2) Is it possible that a SP_receive() call can wake up after a timeout?

What you can do is to write your own select() loop where you pass the 
spread connection's file descriptor as an item to monitor in the readfds 
set.  Then you can use the timeout feature of the select function to 
accomplish what you need.  If the select() detects data on the file 
descriptor, only then call SP_receive().

Also you can read about the event management functions at the end of the 
spread's user guide - they can help you avoid writing your own select loop.

Regards,

Serge

> Thank you for your help.
>  
> Grant Li
> CSG Systems, Inc.
> 





More information about the Spread-users mailing list