LlmSetUserAgent Function  
 
BOOL WINAPI LlmSetUserAgent(
  HCLIENT hClient,  
  LPCTSTR lpszUserAgent  
);

The LlmSetUserAgent function changes the current user-agent string used by the client.

Parameters

hClient
A handle to the client session.
lpszUserAgent
A pointer to a string buffer which will contain the new user-agent string for the current session. If this parameter is NULL or a zero-length string, the function will reset the user-agent string to a default value.

Return Value

If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. To get extended error information, call LlmGetLastError.

Remarks

The LlmSetUserAgent function changes the user-agent string used by the client session. The specified string is trimmed to remove leading and trailing whitespace and will be used the next time the client establishes a connection to the provider.

If lpszUserAgent is NULL or points to an empty string, the current user-agent string is cleared and a new default value is generated for the session.

The default user-agent string uses a format similar to Chromium-based browsers and includes information about the current Windows platform and the SocketTools version. If an application name was specified when the session was created, it may also be included in the default value.

For example, a default user-agent string may look similar to the following:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/134.0.0.0 Safari/537.36 SocketTools/12.0

Applications normally do not need to change the user-agent string. However, a custom value may be useful when an application needs to identify itself to a provider, gateway, proxy, or logging system.

Developers should avoid including sensitive information, such as API keys, account identifiers, or user-specific data, in the user-agent string.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csllmv12.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

LlmGetClientOptions, LlmGetUserAgent, LlmSetClientOptions