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 6928013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:07:44+00:00 2026-05-27T11:07:44+00:00

I am implementing a web server where I need to make the parent process

  • 0

I am implementing a web server where I need to make the parent process do the following:

  • fork() new worker processes (a pool) at the beginning.
  • Looping forever, listening for incoming requests (via socket communication).
  • Putting the socket descriptor (returned by accept() function) into a queue.

and the worker process will do the following:

  • Once created, loops forever watching the queue for any passed socket descriptors.
  • If he takes the socket descriptor, he handles the request and serves the client accordingly.

After looking around and searching the internet, I found that I can send a file descriptor between different processes via UNIX Domain Socket or Pipes. But unfortunately, I can do this synchronously only! (I can send one fd at a time, and I cannot put it in a waiting queue)

So, my question is:

  • How can I make the parent process puts the socket descriptor into a waiting queue, so that, the request is pending until one of the worker processes finishes a previous request?
  • 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-27T11:07:45+00:00Added an answer on May 27, 2026 at 11:07 am

    File descriptors are just integers. They are used to index into a per-process table of file information, maintained by the kernel. You can’t expect a file descriptor to be “portable” to other processes.

    It works (somewhat) if you create the files before calling fork(), since the file descriptor table is part of the process and thus clone()d when the child is created. For file descriptors allocated after the processes have split, such as when using accept() to get a new socket, you can’t do this.

    UPDATE: It seems there is a way, using sendmsg() with AF_UNIX sockets, see here for details as mentioned in this question. I did not know that, sounds a bit “magical” but apparently it’s a well-established mechanism so why not go ahead and implement that.

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

Sidebar

Related Questions

I'm implementing a web - based application using silverlight with an SQL Server DB
we are implementing a new web service. The web service will be a store
I'm implementing a server component that needs to expose a web-service interface, but there
I'm implementing a client-server model for an online store. Basically I need to retrieve
I am implementing a minimalistic web server application on a Microcontroller. When I have
I'm implementing a web server. I have a chat application on it. When I
When implementing a client/server solutions, one of the questions you always need to answer
I am implementing web services for a PHP application and am trying to understand
I am implementing SOAP web services for a commercial application, and I am using
I'm implementing a Web service that returns a JSON-encoded payload. If the service call

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.