sedj
Programmer
- Aug 6, 2002
- 5,610
Hi,
My googling skills appear to be poor today.
Has anyone any idea how (or what commands/methods I should be searching for) to pass a socket descriptor from a parent process to a forked new process ?
For example :
I have an inkling I need to use pipe() and dup(), but I'm not entirely sure how to use them in the parent or the child exe, and I'm darned if I can find any tutorials/examples out there !
Cheers
My googling skills appear to be poor today.
Has anyone any idea how (or what commands/methods I should be searching for) to pass a socket descriptor from a parent process to a forked new process ?
For example :
Code:
int iSockFd = // my socket from an accept() method
if (!fork()) {
execlp("/a/new/executable", "new_process", 0);
// and pass the iSockFd to this executable
} else {
wait(NULL);
}
I have an inkling I need to use pipe() and dup(), but I'm not entirely sure how to use them in the parent or the child exe, and I'm darned if I can find any tutorials/examples out there !
Cheers