In my Server / Client setup, I have client applications that control other applications on the computer (start / stop / reboot / request processes). Right now, I just have a very simple setup using the process ID, but it happened to me before it starts living, I need to improve this.
If the process stops and the other starts to use the same identifier between the moments when I issue a request for it, this will lead to the removal of the system. None of the processes that I start will ever come from the same file path, but often will have the same executable file name.
I was not very lucky to find it, but can I find an executable path for a working service? I believe that the best option when querying the current state would be to first look for the stored identifier of the process on which it should be, if it is running, check the file name / executable name to make sure it also matches.
Would there be a better way to do this, or is this the best possible scenario?
source share