WSServiceRef (C Function)
is a WSTP type that contains a reference to a service discovery browse operation, service resolve operation, or service registration operation.
Details
- The WSTP service discovery facility has three primary operations: browsing for available WSTP services, resolving link connection details for a named service, and registering (or advertising) a named WSTP service. WSTP performs each of these service discovery behaviors in an asynchronous manner. The WSTP library makes callbacks to a program via provided callback functions. The WSServiceRef object contains the data necessary to track each operation.
- WSBrowseForLinkServices() and WSStopBrowsingForLinkServices() initiate and terminate the browse operations for link services.
- WSResolveLinkService() and WSStopResolvingLinkService() initiate and terminate resolve operations for a particular link service.
- WSRegisterLinkServiceWithPortAndHostname(), WSRegisterLinkServiceWithHostname(), and WSRegisterLinkService() initiate the registration (or advertisement) of a link service, while WSStopRegisteringLinkService() terminates a service registration operation.
Examples
Basic Examples (1)
#include "wstp.h"
void BrowseCallbackFunction(WSENV env, WSServiceRef ref, int flag, const char *name, void *context);
WSServiceRef browseForServices(WSENV e)
{
int apiResult = 0;
WSServiceRef ref;
apiResult = WSBrowseForLinkServices(e, BrowseCallbackFunction, NULL /* Use the default browse domain */, NULL /* do not use a context object this time */, &ref);
if(apiResult != 0)
{ /* Handle the error */
return ref;
}