Home   Index   About
Ultimate Pack


Custom Search
WSASetService

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.


Last news from Greatis Software

Nostalgia .Net     Nostalgia .Net     .Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes.  More »

Recommended software for developers

Ultimate Pack for Delphi and C++ Builder     Ultimate Pack     Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price.  More »

Form Designer .Net     Form Designer .Net     Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro!  More »

Print Suite .Net     Print Suite .Net     Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available  More »

Gradient Controls .Net     Gradient Controls .Net     Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available  More »

iGrid     Greatis iGrid     iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors.  More »


All the contacts and projects

Dmitry Vasiliev (just.dmitry)

Related Links

Software for Visual Studio .NET developers
Software for Delphi and C++ Builder developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET

More Online Helps

Win32 Programmer's Reference
Win32 Multimedia Programmer's Reference
OLE Programmer's Reference
Microsoft Windows Pen API Programmer's Reference
Microsoft Windows Sockets 2 Reference
Microsoft Windows Telephony API (TAPI) Programmer's Reference
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008-2012 Free Tech Secrets ;) greatis just4fun network just4fun