Is it possible to release a license key when the c# application is closed? [closed]

StackOverflow https://stackoverflow.com/questions/22301503

  •  12-06-2023
  •  | 
  •  

Question

I'am building a C# application. I send the application to clients with a license key. They must login with that key. Now nobody else can use that key. But now i want to know if it is possible when the client closes the application the license key is released again. So that somebody else can use the application with the same key. Is this possible?

Was it helpful?

Solution

But now i want to know if it is possible when the client closes the application the license key is released again.

Yes. By "Programming". It is a broken concept, though, because what if they do not have internet at that moment? Or the machine crashes?

OTHER TIPS

You can never count on a program exiting gracefully. It could lose network access, power, or have a hardware issue that causes abnormal program termination, resulting in an orphaned license.

Therefore, if you do this, you need to be sure to have a way to timeout your licenses.

And remember: I said, "If." I have to manage an application that does exactly this, and I can tell you that it's a pain on the user side. "Abnormal termination" happens a lot more than you might think, and my users are always needing to wait on license timeouts. It's not a good user experience. Think about all the uproar over the some of the recent video games that have tried to come out with "always on" DRM... that is very similar to what you are proposing, and in most cases the game publishers have eventually backed off of the requirement.

Let's suppose you're using a TcpClient/TcpListener infrastructure to send informations about authentication of your licences keys :

There is two ways to achieve this :

  1. Catch the SocketException on the Server to close the socket and release the key from the pool.
  2. Send a "heartbeat" every 20 secondes with the key to your server, if no heart beat is received within the minute, release the key from the pool.

It will handle all cases like : Loss of connection, power loss, etc...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top