OpenersNotesSection(Spacer1)Details

WSWaitForNewLinkFromLinkServer() waits synchronously for a client to connect to the link server object.

WSWaitForNewLinkFromLinkServer() returns a (NonWLLink[WSLINK, paclet:ref/c/WSLINK]) object representing the connection to the new link object.

The program must call (NonWLLink[WSActivate(), paclet:ref/c/WSActivate]) on the (NonWLLink[WSLINK, paclet:ref/c/WSLINK]) object before any other link operations.

If WSWaitForNewLinkFromLinkServer() encounters an error it will return the error value in err and return ((NonWLLink[WSLINK, paclet:ref/c/WSLINK]))0.   The WSWaitForNewLInkFromLinkServer() succeeds, err will contain zero.

The nonzero values that indicate an error condition correspond to the WSE error codes in (RefLink[wstp.h, paclet:ref/file/wstp.h]) and as returned by (NonWLLink[WSError(), paclet:/ref/c/WSError]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "wstp.h"

void operateLinkServerOnPort(WSENV env, unsigned short port)
{
	int error;
	WSLinkServer linkServer;
	WSLINK theLink;


	linkServer = WSNewLinkServerWithPort(env, port,
		NULL /* No context object for this example */, &error);
	if(error != WSEOK)
	{ /* Handle error */ }

	theLink = WSWaitForNewLinkFromLinkserver(linkServer, &error);
	if(theLink == (WSLINK)0 || error != WSEOK)
	{ /* Handle error */ }

	...

	WSCLose(theLink);

	WSShutdownLinkServer(linkServer);
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSNewLinkServer(), paclet:ref/c/WSNewLinkServer])  ▪  (NonWLLink[WSNewLinkServerWithPort(), paclet:ref/c/WSNewLinkServerWithPort])  ▪  (NonWLLink[ WSNewLinkServerWithPortAndInterface(), paclet:ref/c/WSNewLinkServerWithPortAndInterface])  ▪  (NonWLLink[WSShutdownLinkServer(), paclet:ref/c/WSShutdownLinkServer])  ▪  (NonWLLink[WSRegisterCallbackFunctionWithLinkServer(), paclet:ref/c/WSRegisterCallbackFunctionWithLinkServer])  ▪  (NonWLLink[WSPortFromLinkServer(), paclet:ref/c/WSPortFromLinkServer])  ▪  (NonWLLink[WSInterfaceFromLinkServer(), paclet:ref/c/WSInterfaceFromLinkServer])  ▪  (NonWLLink[WSContextFromLinkServer(), paclet:ref/c/WSContextFromLinkServer])  ▪  (NonWLLink[WSReleaseInterfaceFromLinkServer(), paclet:ref/c/WSReleaseInterfaceFromLinkServer])}})}})

({{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])}})}})