OpenersNotesSection(Spacer1)Details

WSEndPacket() should be called to indicate the end of any top-level expression, regardless of whether its head is a standard packet.

WSEndPacket() returns 0 in the event of an error, and a nonzero value if the function succeeds.

Use (NonWLLink[WSError(), paclet:ref/c/WSError]) to retrieve the error code if WSEndPacket() fails.

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

/* send the expression {10, Times[3.56, 10], 1.3} to a link */

void f(WSLINK lp)
{
	if(! WSPutFunction(lp, "List", 3))
		{ /* unable to send the function List to lp */ }

	if(! WSPutInteger32(lp, 10))
		{ /* unable to send the integer 10 to lp */ }

	if(! WSPutFunction(lp, Times, 2))
		{ /* unable to send the function Times to lp */ }

	if(! WSPutReal64(lp, 3.56))
		{ /* unable to send the double 3.56 to lp */ }

	if(! WSPutInteger32(lp, 10))
		{ /* unable to send the integer 10 to lp */ }

	if(! WSPutReal32(lp, 1.3))
		{ /* unable to send the float 1.3 to lp */ }

	if(! WSEndPacket(lp))
		{ /* unable to send the end of packet message to lp */ }
}

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

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Two-Way Communication with External Programs, paclet:tutorial/TwoWayCommunicationWithExternalPrograms])}, {▪(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[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])}})}})