Re: Fork and Closing Open Sockets



On Nov 17, 10:07 am, Beagle <beagle...@xxxxxxxxxxx> wrote:
Whoops, did "not" say what my question was... I basically want to start a
background process that doesn't inherit any of the open file
descriptors of the parent. Is there a way to do that?

After fork, in the child, iterating thru the list of open fds and
closing them worked.

int pid = fork()
if (pid == 0) {
....
for (int i = 0; i < OPEN_FDS; i++)
close(i);

execl(..);
....
}



On Nov 17, 9:45 am, Beagle <beagle...@xxxxxxxxxxx> wrote:

Folks,

The server pid accepts network connections until the 'host' connection
exits, then all clients exit (e.g. all sockets are closed). A special
case is a recorder shell based client that starts after the first
client connects, but when the host exits, it waits for the shell to
exit before closing the rest of the connections, even though I see in
the logs the server closes all connections.

.



Relevant Pages

  • passing Safearray to VB
    ... I try to pass an array of BSTR to a VB client. ... exits, I get a Firstchance Exception in the Server. ... Dim Experiment As NIRExperiment ...
    (microsoft.public.vc.language)
  • passing Safearray to VB
    ... I try to pass an array of BSTR to a VB client. ... exits, I get a Firstchance Exception in the Server. ... Dim Experiment As NIRExperiment ...
    (microsoft.public.vc.atl)
  • Re: [-mm] Add an owner to the mm_struct (v8)
    ... > process exits. ... On the client side, each JVM instance exits after the test. ... group leader exit as well through getdelays. ...
    (Linux-Kernel)
  • Re: using pthreads with fork() in linux
    ... the child program performs some action and exits. ... If the thread manager fails it may be ... after fork() ...
    (comp.programming.threads)
  • Re: Fork and Closing Open Sockets
    ... The server pid accepts network connections until the 'host' connection ... exits, then all clients exit. ... case is a recorder shell based client that starts after the first ... client connects, but when the host exits, it waits for the shell to ...
    (comp.os.linux.networking)