void WSRegisterCallbackFunctionWithLinkServer(WSLinkServer s, WSNewLinkCallbackFunction f)

registers the callback function f with the link server s.


  • WSRegisterCallbackFunctionWithLinkServer() allows a program to 'install' a callback function f with a link server object s, so that when the link server receives an incoming connection, the link server will asynchronously notify the program of the new connection via the callback function.
  • The link server object will make callbacks to the callback function f asynchronously so the program must take care to protect access to shared data structures accessible through f from asynchrous access problems.
  • If the link server has more than one connection waiting in its connection queue, the link server will call the callback function f one time for each connection in its queue.


Basic Examples  (1)

#include "wstp.h"

void NewLinkCallbackFunction(WSLinkServer server, WSLINK link);

WSLinkServer startLinkServer(WSENV env)
    WSLinkServer theServer;
    int error;

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


    return theServer;

void NewLinkCallbackFunction(WSLinkServer server, WSLINK link)
        WSPutString(link, "Hello Client Program");



See Also

WSNewLinkServer()  WSNewLinkServerWithPort()  WSNewLinkServerWithPortAndInterface()  WSShutdownLinkServer()  WSWaitForNewLinkFromLinkServer()  WSPortFromLinkServer()  WSInterfaceFromLinkServer()  WSContextFromLinkServer()  WSReleaseInterfaceFromLinkServer()