I have to run a ssh
command in a separate process (so by means of execlp
) to connect the running machine to another machine in the same local network. The thing is, I have to establish the hostname entered is valid so the ssh
connection succeeds.
Since, execlp
replaces the calling process' image on a successful command run (which will be the case with ssh
), there is, to the best of knowledge, no way of knowing in the calling process whether the ssh
connection was successfully set up.
Hence, the sole solution to this incovenient behavior way I can think up is to assert the given hostname of the machine to connect to is valid. How can/should I about that?
(A valid hostname is simply one that exists and, of course, is reachable, be it an IP adress or an alias)