Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

LMX_ServerFunction sends a message to the license server for processing for a checked out feature. The license server will invoke the specified custom callback function and return a response.

...

Prototype

...

Code Block

...

language

...

cpp
LMX_STATUS LMX_ServerFunction

...


(
   LMX_HANDLE LmxHandle,

...


   const char *szFeatureName,

...


   char *szMessage

...


);

...

Parameters

LmxHandle
[in/out] LM-X handle.

szFeatureName
[in] Feature name.

szMessage
[in/out] The message to send and the response.

...

...

Return

...

values

On success, this function returns the status code LMX_SUCCESS.

On failure, this function returns an error code in the format described in Return codes.

...

...

Remarks

This function will send a message to the server from which a feature was checked out.

The length of the message sent to the server and the response can be up to LMX_MAX_LONG_STRING_LENGTH bytes.

In order for this function to succeed, the license server must have a function callback implemented. See lmxserverconf lmx_server_conf.c for details.

Example:

The following example shows a function that could be registered in lmxserverconf lmx_server_conf.c:

Code Block
languagecpp
/* The function parameters should be overwritten by the response back to the client. */

...


void LMX_CALLBACK ServerFunc(char *szMessage)

...


{
  char *szTest = "this is a simple response";

...


  LmxLogprintf("server function called: %s", szMessage);

...


  
  /* Use the client message in some way ...*/

...


  ...

...


  ...

...


  ...

...


  /* Prepare response */

...


  strcpy(szMessage, szTest);

...


}

The client can then invoke the function given above as follows:

Code Block
languagecpp
char szMyMessage[LMX_MAX_LONG_STRING_LENGTH+1];

...


char *szString = "This is my simple query";

...


int nLength;

...


LMX_STATUS LmxStat;

...


/* Specify a message to send (here we use a zero-terminated string, but any data could be used */

...


strcpy(szMyMessage, szString);

...


LmxStat = LMX_ServerFunction(handle, "f1", szMyMessage);

...


/* Now the query has been replaced with a response */

...


/* Print out the response since we know the server sent us a string */

...


printf("%s\n", szMyMessage);