Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6965607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:04:59+00:00 2026-05-27T16:04:59+00:00

I have a PERL script that is creating a lot of sockets (around 700

  • 0

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:

  1. Does the system command make the application launched inherit all the open file descriptors/sockets?
  2. 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?
  3. If the answer to 2. is no, then is there some way to close all inherited file descriptors in the child process?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:05:00+00:00Added an answer on May 27, 2026 at 4:05 pm

    Take a look at the perlvar $^F which controls which file descriptors are set for close-on-exec. The default setting should be closing all those socket descriptors when you call system(), but if not, perhaps $^F isn’t set to what you want. A very quick and easy way to tell on a Linux system would be to try this call right before your existing system() call:

    system("ls -l /proc/self/fd");
    

    the output of the ls will show you what files were left open when the “ls” command was executed. Most likely you will see that only stdin, stdout, and stderr (descriptors 0, 1, and 2) are open, but if you see your socket descriptors open, I would try setting $^F = 2 and see if that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a perl script that does a lot of config file parsing for
I have a Perl script that uses WWW::Mechanize to read from a file and
I have a Perl script that uses Term::ANSIColor . It used to be the
I have a simple perl script that uses DBD::Oracle to run a query and
I have a Perl script that uses a DBI connection. I open and read
I have a Perl script that takes user input and creates another script that
I have a Perl script that takes text values from a MySQL table and
I have a Perl script that launches 2 threads,one for each processor. I need
I have a Perl script that requires a couple of plugins, for istance nmap.
I have a Perl script that will execute three applications. All of it have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.