How to Acknowlege Connection to LimeLM Server

I have switched the code in my product from using unverified trial versions to verified trial versions.

My problem is in writing clean code to manage the activation/deactivation for 1) a PC that is online and can connect to the LimeLM servers and 2) using the offline activation/deactivation files for non-connected PCs.

Different logic is needed for each of the two cases.

It would be helpful to have a means to simply send a request to the LimeLM servers to see if 1) the PC has an Internet connection; and 2) can get a response from your servers. Then the code could branch, as needed, to work with online versus offline or activations and deactivation, preventing unwanted exceptions, such as a call to TurboActivate.Deactivate, which fails when the PC is offline ('Connection to the server failed.').

That would make it easier to write clean code.

I don't see anything in your code that supports this. Am I missing something?

>> "My problem is in writing clean code to manage the activation/deactivation for 1) a PC that is online and can connect to the LimeLM servers and 2) using the offline activation/deactivation files for non-connected PCs. "

Well, you should handle activations using the only activation functions: CheckAndSavePKey(), Activate(). And if Activate() throws an InternetException then you know that the customer is (a) not connected to the internet or (b) actively blocking your app's access to the activation servers.

There's no way to tell which is happening.

So, handle InternetException, and by handle it I mean prompt the user to activate offline: https://wyday.com/limelm/help/offline-activation/

>> "I don't see anything in your code that supports this. Am I missing something?"

You're free to re-write the TurboActivateUnit.pas to not throw exceptions, and instead return the error codes. Neither is "cleaner" than the other. We try to stick to the conventions of the programming language that we write examples for. And the conventions of Delphi are throwing exceptions on errors.

OK. I understand your points and logic. Thank you for your quick response!

Sure, no problem.