in reply to Re: TCP Server Exits Loop and Crashes with error
in thread TCP Server Exits Loop and Crashes with error

Two random comments:

Instead of killing the childs you could wait for them to finish with wait(). Are you sure that the child has always finished the task when you kill it?

You have an exit(fork); right after the doSSH. It might be some clever construct I just don't get, but it looks like a senseless fork, where both parent and child exit immediately after the fork. Shouldn't it be just exit();?