I am building a multi-threaded HTTP server. This is part of a university course I am taking. The server needs to have a dedicated thread which has to listen to incoming HTTP requests and insert them in a ready queue from where a scheduling thread will assign execution threads.
I don't know how to do that. If anyone could explain the direction in which I should proceed it would be very helpful.
[I had recently asked an unrelated question here: How to parse HTTP requests from a C based web server ]
listen(). man7.org/linux/man-pages/man2/listen.2.html So should I be trying to use that queue or should I be using my own queue [where I would be stuffing structs for each request which contain the integers returned by accept()]listen()opens the queue of inbound client connections thataccept()establishes connections from, nothing more. They have no concept of how the connections will be used. HTTP requests are data packets sent over those connections after they have been established. So you need to do your own queuing of the HTTP processing over the accepted connections.