OpenersNotesSection(Spacer1)Details

Analogous to the Wolfram Language function (RefLink[LinkReadyQ, paclet:ref/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.

If you have written data to the link, 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.

If link has not been activated, then WSReady() returns 0 if the other side of the link has not been created.

WSReady() is declared in the WSTP header file (RefLink[wstp.h, paclet:ref/file/wstp.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "wstp.h"

/* check a link for readable data */

void f(WSLINK 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 */ }
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSReadyParallel(), paclet:ref/c/WSReadyParallel])  ▪  (NonWLLink[WSFlush(), paclet:ref/c/WSFlush]) ▫ (NonWLLink[WSActivate(), paclet:ref/c/WSActivate])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Running the Wolfram System from within an External Program, paclet:tutorial/RunningTheWolframSystemFromWithinAnExternalProgram])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}, {▪(RefLinkPlain[C/C++ Language Interface, paclet:guide/CLanguageInterface])}, {▪(RefLinkPlain[Low-Level WSTP Operations, paclet:guide/LowLevelWSTPOperations])}, {▪(RefLinkPlain[WSTP C Language Functions, paclet:guide/WSTPCLanguageFunctions])}})}})