[Spread-users] SP_poll() result when spread daemon is dead

Matt Garman matthew.garman at gmail.com
Thu Sep 20 16:48:50 EDT 2007

On 9/20/07, Colin Meyer <cmeyer at helvella.org> wrote:
> When testing, I manually kill spread, but the polling process just
> receives 0 from SP_poll().
> I'd like to know when I'm not going to receive anything. I'd like to
> avoid sending heartbeat messages, just to detect if I'm still talking to
> spread. What is the normal way to do this?

Hi, I just asked virtually the same question, and I came to the
conclusion that there's no way to tell if the mbox has become
disconnected with SP_poll() alone.

There are two options (maybe more, but these are the only two I know):

    (1) Just use SP_receive(), which can detect if the daemon is
dead/disconnected.  However, SP_receive() is blocking, so you may have
to do this in a separate thread, depending on your program's flow.

    (2) Use either your system's select() call or Spread's event
interface to watch for activity on the mbox.  You can use this to
detect anything that happens to an mbox, including disconnect from the

Good luck,

More information about the Spread-users mailing list