OpenersNotesSection(Spacer1)Details

The following packets can be returned:

WSNextPacket() returns ILLEGALPKT in the event of an error. (RefLink[wstp.h, paclet:ref/file/wstp.h]) defines ILLEGALPKT as 0.

WSNextPacket() 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"

/* read the type of the incoming packet on a link */

void f(WSLINK lp)
{
	switch(WSNextPacket(lp))
	{
		case CALLPKT:
			/* read the CallPacket[] */
			break;
		case EVALUATEPKT:
			/* read the EvaluatePacket[] */
			break;
		case RETURNPKT:
			/* read the EvaluatePacket[] */

		/* ... */

		case ILLEGALPKT:
			/* unable to read the next packet from lp */
	}	
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSNewPacket(), paclet:ref/c/WSNewPacket])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(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[WSTP API, paclet:guide/WSTPAPI])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Expressions, paclet:guide/WSTPCFunctionsForExchangingExpressions])}, {▪(RefLinkPlain[WSTP C Language Functions, paclet:guide/WSTPCLanguageFunctions])}, {▪(RefLinkPlain[WSTP Expression Packet Handling, paclet:guide/WSTPExpressionPacketHandling])}})}})