Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I detect another instance of the same Win32 application running on another workstation?

I have a small application, which is free for personal use, but requires a paid license for corporate use.

It is most likely that in a corporate environment my application will run on multiple workstations. If it is the freeware version, I want to show an unobtrusive message. (and continue)

It doesn't have to be bulletproof, if it is not possible (i.e. firewall) then the application should just continue. And I don't want to make the user set up some kind of central service to track the instances. I don't want to annoy my users (especially not the paying ones *g*)

Is there any way to achive this kind of functionality?

I remember an older version of Dreamweaver had this kind of feature. You couldn't run it more than once in the same network.

like image 376
Daniel Rikowski Avatar asked Dec 30 '22 05:12

Daniel Rikowski


1 Answers

One way: Listen for UDP broadcast on specific ports. Let each instance send broadcast UDP packet on this port to local network. If application receives such packet, and recognizes its structure, it knows that other instance is running.

You can include license details to avoid messages if two valid licenses are used.

Broadcasts usually aren't routed, so this works on local network only. (And user can disable it completely via firewall too... but if you will use some standard port like 53 (DNS), it won't be blocked).

Other way is to use custom server, which is informed about all running instances around the world ;-)

like image 143
Peter Štibraný Avatar answered May 11 '23 10:05

Peter Štibraný