Link to home
Start Free TrialLog in
Avatar of richardoc
richardoc

asked on

Applet licensing mechanism - CPU license

Hi All,

I've got a commercial java applet which I usually license on a per-domain basis. I have a licensing mechanism in place for covering this, where the applet is supplied with a license key at runtime.

However, I have a requirement to be able to license the applet on a per-server (CPU) basis. I have seen a number of commercial applets licensed in this way, and I am hoping I can get some advice here on how to implement such a mechanism.

The licensing is used as a deterent obviously - I am well aware that licensing mechanisms in applets are not bullet-proof, but some sort of licensing effort is better than nothing! :-)

Just incase it makes any difference or opens up any options, the applet is digitally signed.

Any ideas / advice?

Thank you in advance.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of richardoc
richardoc

ASKER

Thanks for your suggestions!

Only problem is that, I need to restrict it to a particular server, not client. If I could get the IP address of the server that served up the applet, that might do the trick.
If the IP address is fixed, you could try

InetAddress.getLocalHost()
Correction - that's nonsense (returns client address). Try

this.getDocumentBase()

Yes, but surely that will return the ip address of the client machine that the applet is running on, and not the IP address of the server that served up the applet.
I'm trying to restrict the applet to a single server - not a single client.
>>Yes, but surely that will return the ip address of the client machine

(See my correction above)
getDocumentBase will just return the url of the page the applet was loaded from:
http://java.sun.com/j2se/1.4.2/docs/api/java/applet/Applet.html#getDocumentBase()
And getHost() will just return the domain part of the url.

I need to get the IP it was served from, because the the applet could get served from 1 of 100 domains running on the server; hence the need for a cpu license.
Its actually very straightforward to get the IP from a hostname:

InetAddress inet = InetAddress.getByName("www.hostname.com");
System.out.println ("IP  : " + inet.getHostAddress());

Thanks anyway.
:-)

Yes, the hostname *is* the IP address ;-)