I have a PERL script that is creating a lot of sockets (around 700 sockets) and then does stuff with those sockets. After that, it uses system(...)
command to launch another application which opens even more sockets (like 800 or so) but since the limit on the number of sockets per process is 1024
, I exceed the limit and don't get the expected data from the socket number 1024 and onwards.
Now my question is this:
- Does the system command make the application launched inherit all the open file descriptors/sockets?
- If the answer to the above question is yes, then is there some other way to launch another application such that the launched application does not inherit the file descriptors?
- If the answer to 2. is no, then is there some way to close all inherited file descriptors in the child process?