WSRegisterCallbackFunctionWithLinkServer (C 函数)
void WSRegisterCallbackFunctionWithLinkServer(WSLinkServer s, WSNewLinkCallbackFunction f)
用链接服务器 s 注册回调函数 f.
范例
基本范例 (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 */ }
WSRegisterCallbackFunctionWithLinkServer(theServer,
NewLinkCallbackFunction);
return theServer;
}
void NewLinkCallbackFunction(WSLinkServer server, WSLINK link)
{
WSActivate(link);
WSPutFunction(link,"Print",1);
WSPutString(link, "Hello Client Program");
WSEndPacket(link);
WSFlush(link);
...
WSClose(link);
}