Re: Call queueing


John Romkey (asylum!romkey@ames.arc.nasa.gov)
27 Aug 88 20:45:59 PDT (Sat)


jgh@root.co.uk asked about why listen(2) allows a queue of pending
connection requests.

Under the BSD networking model, when you want to listen() for a
connection, you first get a socket and then listen() on it. When a
connection is opened, you do an accept() (which gets you a new socket)
to actually get ahold of the connection. A server which wants to be
able to handle more than one connection at a time normally fork()s,
and the child process does the actual work while the parent goes back
to listen()ing.

If you don't allow a queue of pending requests, then from the time
when the listen() completes to the time when the server issues a new
listen(), there is no one listening. Any incoming requests will then
get a reset. The window of time is probably pretty small, on the order
of milliseconds, but you want it to be 0. So you need listen() to be
able to handle more than one incoming request. And you have to tell
listen() how many to handle so that the kernel can allocate
appropriate resources.
                                - john romkey



This archive was generated by hypermail 2.0b3 on Thu Mar 09 2000 - 14:43:14 GMT