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

Li, Grant Grant_Li at csgsystems.com
Mon May 9 11:02:48 EDT 2005


Serge/Ryan/Yuval,

Thank you very much for your help.

Grant Li

-----Original Message-----
From: Serge Aleynikov [mailto:serge at hq.idt.net] 
Sent: Sunday, May 08, 2005 8:23 PM
To: Li, Grant
Cc: spread-users at lists.spread.org
Subject: Re: [Spread-users] Spread Questions: Asynchronous/Receive with
timeout



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