• Post Reply Bookmark Topic Watch Topic
  • New Topic

prevent 2 instances of same program  RSS feed

 
Jacob Whitten
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using Christian Schlichtherle's TrueZip classes for encryption and compresssion in my desktop software

i would like to prevent 2 instances of my program running. I have no idea
where to start

i have done hundreds of tests and simulated many different user scenarios and i know there can be a problem with encryption if 2 instances of the program are open because i have an option for the archive to get updated in realtime instead of after program close
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The normal way to do this is to try and open a network socket on a specific port. If the socket is opened successfully then no other instance of your program is running. If it doesn't, then another instance must have got there first. This obviously relies on no other program using the same port number.
This question gets asked quite often so try searching the forums and you may find some sample code and alternative methods.
 
Jacob Whitten
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok something else to learn - will do as suggested - look at the other posts -thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!