cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Occasional contributor

Re: Actual server/license file used?

Jump to solution

Hi again!

Still no one could answer my question. So I try once again. 🙂

Is there a possibility in C Code to find out where a license has been checked out?

status = lc_checkout(job, feature, version, num_licenses, flag, key, dup_group)
config = lc_auth_data(job, feature)

Now is there a way to use f.ex. config to extract information where the feature has been checked out (server, local license file etc.)?

 

Thanks for helping

 

Regards

   Christian

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Flexera
Flexera

Re: Actual server/license file used?

Jump to solution

@chris58 , you may want to try a sample on something like this:

char ** cp;

CONFIG * conf;

conf = lc_get_config(lm_job, feature);
lic_pos = conf->lf;
count = 0;
lc_get_attr(lm_job, LM_A_LF_LIST, (short *)&cp);
if (*cp)
{
    while (*cp)
    {
        if (count == lic_pos)
        {
            printf("The current feature is checked out from -->%s\n",(short *)*cp);

            break;
        }
        count++;
        *cp++;
    }
}

(If my response assists with your questions , then please click "ACCEPT AS SOLUTION" or 'Kudos' so that it help others.)

View solution in original post

3 Replies
Highlighted
Active participant

Re: Actual server/license file used?

Jump to solution

There is an "lf" field in the CONFIG struct that is the index of which license file is used (probably indexed into the LM_A_LF_LIST attribute).   However, I don't believe this is documented, and therefore may have strange behaviors when using environment variables or license servers.  I've done some playing around with this, and have never quite figured out exactly how it works (does an invalid port@host entry count as an index?  do environment variable entries count as well as entries in LM_A_LICENSE_DEFAULT?)

If you are just using it for debugging it might help you do what you need, but it probably isn't reliable for production quality features unless you have a rigid definition of your license search path.

 

0 Kudos
Highlighted
Flexera
Flexera

Re: Actual server/license file used?

Jump to solution

@chris58 , you may want to try a sample on something like this:

char ** cp;

CONFIG * conf;

conf = lc_get_config(lm_job, feature);
lic_pos = conf->lf;
count = 0;
lc_get_attr(lm_job, LM_A_LF_LIST, (short *)&cp);
if (*cp)
{
    while (*cp)
    {
        if (count == lic_pos)
        {
            printf("The current feature is checked out from -->%s\n",(short *)*cp);

            break;
        }
        count++;
        *cp++;
    }
}

(If my response assists with your questions , then please click "ACCEPT AS SOLUTION" or 'Kudos' so that it help others.)

View solution in original post

Highlighted
Occasional contributor

Re: Actual server/license file used?

Jump to solution

Hi!

Thank you very much @aparashar1 and @raffie ! 🙂

I added the code below to check whether the license is checked out by a server or not. In case somebody needs the info. It works for me.

Regards

    Christian

 

if(conf->lc_from_server // this config comes from license server
    && conf->server
    && conf->server->name){
  printf("licensed from server=%s\n", conf->server->name);
}

0 Kudos