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.Code:if (fork() == 0) { close(1); dup(socket_fd); execvp(pointer_array[0], pointer_array); //pointer_array = command/arguments } else { printf("Parent Process!\n"); }
I was following the advice here: redirecting stdout to a socket, but that clearly doesn't work.
The thread here: Redirecting stdout to socket seemed promising, but I don't know how to use dup2 and fflush together properly.
Thanks!