Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Dec 1999 19:14:54 -0800 (PST)
From:      John Polstra <jdp@polstra.com>
To:        rfg@monkeys.com
Cc:        hackers@freebsd.org
Subject:   Re: Practical limit for number of TCP connections? 
Message-ID:  <199912200314.TAA30474@vashon.polstra.com>
In-Reply-To: <42829.945549667@monkeys.com>
References:  <42829.945549667@monkeys.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <42829.945549667@monkeys.com>,
Ronald F. Guilmette <rfg@monkeys.com> wrote:
> 
> The other way is just have your server be a single thread/process, and to
> have it keep one big list of all of the connections (i.e. socket fds) that
> it has open at present.  Then it just executes mail loop, over and over
> again.  At the top of the main look is one big honkin' call to select()
> in which you find out which of your connections is ready to be read or
> written.  Then you go off and read/write those as appropriate, and then
> just come back and do the big select() again.  (You could do this using
> calls to poll() instead of calls to select(), and that might be a bit
> more efficient.)
> 
> The only real problem with doing things this way is that you have to diddle
> some things to make sure the bit arrays that you pass to select() are big
> enough to handle the maximum number of connections you ever anticipate
> having to service/maintain at one time.
[... etc]

The "eventlib" package is pretty nice for this style of programming.
It takes care of all these gory details for you.  It's part of BIND
(www.isc.org) and it might be distributed separately too -- I forget.

John
-- 
  John Polstra                                               jdp@polstra.com
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "No matter how cynical I get, I just can't keep up."        -- Nora Ephron


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912200314.TAA30474>