WSMessageReady()

int WSMessageReady(WSLINK link)

queries the link object link to see if the link has an out-of-band message.

Details

  • WSMessageReady() returns a nonzero value if a message is available for reading and 0 otherwise.
  • WSMessageReady() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* calculate the sum of the integers in a list and check for a message on a link */

int f(WSLINK lp, int *list, int len)
{
    int sum;
    while(len--)
    {
        sum += *list++;
        if(WSMessageReady(lp))
            { /* read the message */ }
    }

    return sum;
}

See Also

WSPutMessage()  WSPutMessageWithArg()  WSGetMessage()  WSSetMessageHandler()  WSGetMessageHandler()

Tutorials