WSReady()
This feature is not supported on the Wolfram Cloud.

int WSReady(WSLINK link)
tests whether there is data ready to be read from link.

DetailsDetails

  • Analogous to the Wolfram Language function LinkReadyQ.
  • WSReady() is often called in a loop as a way of polling a WSTP connection.
  • WSReady() will always return immediately, and will not block.
  • You must call WSFlush() before calling WSReady().
  • WSReady() returns 0 if the link has no data to read and a nonzero value if the link does have data.
  • WSReady() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

/* check a link for readable data */

void f(WSINK lp);
{
    if(! WSFlush(lp))
        { /* unable to flush any outgoing data buffered in lp */ }

    if(WSReady(lp))
        { /* read the data from the link */ }
    else
        { /* data not ready to read */ }
}