SDKs
...
v2
Samples

Floating License

5min
license check the checklicense function is not only used to validate the current license status, but also plays a role in floating licenses if the license is of floating cloud type, calling checklicense will automatically assign one floating slot to the current machine, identified by its hardware id 	ld, err = lh checklicense(ctx) 	if err != nil { 	 return err 	} borrow floating licenses come with a predefined floating period —a time frame in which the license is valid on a given machine if the license configuration allows, this period can be borrowed or extended for offline usage you can extend the floating period using one of two methods borrow for a specific number of hours and days 	ld, err = lh borrowhoursanddays(ctx, 3, 0) 	if err != nil { 	 return err 	} borrow until a specific time 	t = time now() add(3 time hour) utc() 	ld, err = lh borrow(ctx, \&t) 	if err != nil { 	 fmt println("license borrow error %w", err) 	 return err 	} these functions will only succeed if the license allows borrowing and there are available slots or permissions for the request release floating license if you no longer need the license on the current machine, or want to release a floating slot before the borrow period ends, you can call 	ld, err = lh releasefloatinglicense(ctx) 	if err != nil { 	 return err 	} this function immediately frees up the slot assigned to the current machine, making it available for others