I need to implement simple license control in B2B software (SW). My SW should be able to count the number N of simultaneously running instances of SW over current intranet and exit the process in case when N is greater then the number of purchased licenses. So that N would be the maximum number of simultaneously running instances of SW over the intranet.

I convinced that there should be existing solution to this problem (library or smth. like that) but I couldn't find any neither in internet nor at codeguru.
Could anyone suggest anything that could be useful for me.

Thanks in advance!