- Revenera Community
- :
- FlexNet Publisher
- :
- FlexNet Publisher Forum
- :
- Re: Actual server/license file used?
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
@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++;
}
}
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
@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++;
}
}
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
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);
}
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)