-1

In The Linux Programming Interface, Chapter 60 talks about

  • designing a server to concurrently handle multiple clients, by using sockets, multiple processes/threads or thread/process pools

  • designing a server to be invoked by inetd which simplifies the sever program.

If a server is to be used with inetd, it only has to deal with inputs from stdin and outputs to stdout, instead of sockets. inetd handles the part of using sockets, multiplex monitors for incoming requests, and for each incoming request, forks a process to execute a server program.

I was wondering if a server program to be used with inetd can still have the same part of concurrently handling multiple clients, as a standalone version of the server program?

Is it correct that inetd forks a new process for each incoming request, to execute the entire server program?

So does the server program not need to handle multiple requests concurrently, but only one request?

Does inetd makes the server program equivalent to a concurrent standalone version which forks a child process to process each received request?

Is that a good choice compared to a standalone multithreaded server program?

Thanks.

1
  • I'm afraid the formulation "Is that a good choice" makes this question at least in part fall under the category "opinion-based", since "good" without specifying a metric is rather subjective. Also, having multiple questions in one would make this fall under the category of "needs more focus". May I recommend you reformulate the question to avoid attracting close votes? Commented Nov 26, 2020 at 16:24

1 Answer 1

2

Yes, inetd will fork your program, meaning that each instance will serve a single client.

The question "to inetd or not to inetd" has more info on when it would make more sense to handle the concurrency in the program and when to let inetd take care of it.

2
  • Does inetd makes the server program equivalent to a concurrent standalone version which forks a child process to process each received request? Is that a good choice compared to a standalone multithreaded server program? Commented Nov 25, 2020 at 0:04
  • For example, with inetd you'd have to do some sort of IPC in order to communicate information or share resources between the individual instances. So, inetd simplifies your server, but at the same time reduces the things you can do inside it. The above question does have some good info on that. Commented Nov 25, 2020 at 0:11

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.