Best way to relaunch executable (cross platform)?

122 Views Asked by At

Background:

So I have client/server type of app rolled into the same executable.

What I want is if it fails to connect on the localhost, it should start itself (same executable, but with different parameters/command so to start the server). Then perhaps wait a bit and then try to connect again (only try once). This is different from, but similar, to fork()'ing (which I could have used, but fork() is not cross platform).

Question

I know boost::process can launch the process in a platform independent manner, but is there a way to obtain the path of the process so that to launch oneself (cross platform) ?

0

There are 0 best solutions below