WSASetService  I82ZR4

The Windows Sockets WSASetService function registers or deregisters a service instance within one or more name spaces. This function can be used to affect a specific name space provider, all providers associated with a specific name space, or all providers across all name spaces.

INT WSASetService(

    LPWSAQUERYSET lpqsRegInfo,

 

    EWSASETSERVICEOP essOperation,

 

    DWORD dwControlFlags

 

   );

 

 

Parameters

lpqsRegInfo

[in] Specifies service information for registration, identifies service for deregistration.

essOperation

[in] An enumeration whose values include:

RNRSERVICE_REGISTER

Register the service. For SAP, this means sending out a periodic broadcast. This is a NOP for the DNS name space. For persistent data stores this means updating the address information.

RNRSERVICE_DEREGISTER

Deregister the service. For SAP, this means stop sending out the periodic broadcast. This is a NOP for the DNS name space. For persistent data stores this means deleting address information.

RNRSERVICE_DELETE

Delete the service from dynamic name and persistent spaces. For services represented by multiple CSADDR_INFO structures (using the SERVICE_MULTIPLE flag), only the supplied address will be deleted, and this much match exactly the corresponding CSADD_INFO structure that was supplied when the service was registered.

dwControlFlags

[in] The meaning of dwControlFlags is dependent on the value of essOperation as follows:

essOperation

dwControlFlags

Meaning

REGISTER

SERVICE_MULTIPLE

The service being registered may be represented by multiple CSADDR_INFO structures

 

Service Properties

The following table describes how service property data is represented in a WSAQUERYSET structure. Fields labeled as (Optional) may be supplied with a NULL pointer.

WSAQUERYSET Field Name

Service Property Description

Field Name

Service Property Description

dwSize

Must be set to sizeof(WSAQUERYSET). This is a versioning mechanism.

dwOutputFlags

Not applicable and ignored.

lpszServiceInstanceName

Referenced string contains the service instance name.

lpServiceClassId

The GUID corresponding to this service class.

lpVersion

(Optional) Supplies service instance version number.

lpszComment

(Optional) An optional comment string.

dwNameSpace

See table below.

lpNSProviderId

See table below.

lpszContext

(Optional) Specifies the starting point of the query in a hierarchical name space.

dwNumberOfProtocols

Ignored.

lpafpProtocols

Ignored.

lpszQueryString

Ignored.

dwNumberOfCsAddrs

The number of elements in the array of CSADDRO_INFO structures referenced by lpcsaBuffer.

lpcsaBuffer

A pointer to an array of CSADDRO_INFO structures which contain the address9(es) that the service is listening on.

lpBlob

(Optional) This is a pointer to a provider-specific entity.

 

As illustrated below, the combination of the dwNameSpace and lpNSProviderId parameters determine which name space providers are affected by this function.

dwNameSpace

lpNSProviderId

Scope of Impact

Ignored

Non-NULL

The specified name space provider

a valid name space ID

NULL

All name space providers that support the indicated name space

NS_ALL

NULL

All name space providers

 

Return Values

The return value is zero if the operation was successful. Otherwise, the value SOCKET_ERROR is returned, and a specific error number may be retrieved by calling WSAGetLastError.

Error Codes

WSAEACCESS

The calling routine does not have sufficient privileges to install the Service.

WSANOTINITIALIZED

The Windows Sockets 2 DLL has not been initialized. The application must first call WSAStartup before calling any Windows Sockets functions.