Redirect stdout to inet socket!
Hello, I'm wondering how to send stdout of a execvp() call to an open inet socket.
After setting up the socket, and accepting a connection on it, here is what I have:
However, nothing happens! I don't receive anything at the other end of the socket! However, I also dont see the output of the execvp() call, so stdout is getting redirected, just not to the socket.
if (fork() == 0)
execvp(pointer_array, pointer_array); //pointer_array = command/arguments
I was following the advice here: http://cboard.cprogramming.com/linux...ut-socket.html, but that clearly doesn't work.
The thread here: http://cboard.cprogramming.com/c-pro...ut-socket.html seemed promising, but I don't know how to use dup2 and fflush together properly.