Just because the program has 'started' doesn't mean the shared memory has been set up yet. I haven't looked at the details of QProcess' implementation, but it seems like a more robust solution for you here would be to:
1) start process and determine that the launch was successful
2) attempt for some period of time via a polling loop to connect to the shared memory
You should have a reasonable notion of how long client.exe takes to set up its shared memory in most cases. Since you're dealing w/ interprocess communication here, on a shared resource, assuming that any specific time will always be enough is less than optimal. I'd suggest having a 'timeout' parameter, and if you fail to be able to connect to the shared memory after that amount of time, give up.
Bookmarks