WSASetService (Bluetooth) (Windows CE 5.0)

Send Feedback

This function adds, updates, or removes service records from the local SDP database.

Note   This function is actually a Winsock function. However, the information that is presented in it is specific to Bluetooth.

INTWSASetService(LPWSAQUERYSETlpqsRegInfo,WSAESETSERVICEOPessoperation,DWORDdwControlFlags);

Parameters

  • lpqsRegInfo
    [in] Pointer to the service information for registration or deregistration.
  • essoperation
    [in] Value that is to be set to RNRSERVICE_REGISTER.
  • dwControlFlags
    [in] Flag that is to be set to zero.

Return Values

If the operation is successful, the return value is zero (ERROR_SUCCESS). Otherwise, the value SOCKET_ERROR is returned. The following table shows possible error codes for the last error, if SOCKET_ERROR is set.

Error code Description
WSASERVICE_NOT_FOUND SDP is not running.
WSAEINVAL The parameter is invalid.
WSA_NOT_ENOUGH_MEMORY Memory is insufficient.

Remarks

Servers use this function to register specific service information with SDP. The following table shows the fields of the WSAQUERYSET (Bluetooth) structure that are associated with values in the SDP record.

Field Subfield Description
lpqsRegInfo dwSize sizeof(WSAQUERYSET)
  lpszServiceInstanceName Not supported on Windows CE. Set to 0.
  lpServiceClassId Not supported on Windows CE. Set to 0.
  dwNameSpace NS_BTH.
  dwNumberOfCsAddrs Not supported on Windows CE. Set to 0.
  IpcsaBuffer Not supported on Windows CE. Set to 0.
  lpBlob Points to a BTHNS_SETBLOB structure, containing information about the service to be added.
  * All other WSAQUERYSET fields are ignored.
essOperation   RNRSERVICE_REGISTER.
dwControlFlags   Equal to 0 (clear).

This function can be used to update an existing SD record with new information. The parameters of the call are the same as in the initial record registration. The following table shows the exceptions.

Field Subfield Description
lpqsRegInfo lpBlob BTHNS_SETBLOB structure, containing the service record handle. The service record handle is a critical piece of data. Any differences between the existing SD record and the passed in SD record will be applied to match the passed in record. Attributes could be added, changed, or deleted, so long as the resulting record is legal according to SDP. Changes that could result in an invalid record cause this function to return an error. If an error is returned, the existing SDP record remains unchanged.

This function can be used to delete existing SDP records. The following table shows the fields of the WSAQUERYSET structure.

Field Subfield Description
lpqsRegInfo dwSize sizeof(WSAQUERYSET)
  dwNameSpace NS_BTH.
  lpBlob BTHNS_SETBLOB structure, containing the service record handle.
  * All other fields are ignored.
essOperation   RNRSERVICE_DELETE.
dwControlFlags   0 (clear).

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Winsock2.h.
Link Library: Ws2.lib.

See Also

Bluetooth Application Development Functions | WSAQUERYSET (Bluetooth) | BTHNS_SETBLOB

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.