From owner-freebsd-hackers Thu Nov 16 15:20: 3 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from shell.unixbox.com (shell.unixbox.com [207.211.45.65]) by hub.freebsd.org (Postfix) with ESMTP id 45D3937B479 for ; Thu, 16 Nov 2000 15:20:00 -0800 (PST) Received: from localhost (fengyue@localhost) by shell.unixbox.com (8.11.0/8.11.0) with ESMTP id eAGNKTA18801 for ; Thu, 16 Nov 2000 15:20:29 -0800 (PST) Date: Thu, 16 Nov 2000 15:20:29 -0800 (PST) From: FengYue X-Sender: fengyue@shell.unixbox.com To: freebsd-hackers@FreeBSD.ORG Subject: Re: Multithreaded tcp-server or non-blocking ? In-Reply-To: <200011162235.RAA27714@thunderer.cnchost.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 16 Nov 2000, Bakul Shah wrote: ->The simplest solution is to just fork a new process on ->accepting a new connection. A sample implementation is why not just bind to the port and then spawn off some processes (like 20 in his case) to do the accept(), once the accept() returns successfully just take care of the request, close the connection and then goes back to accept(). Simple, easy, and even scales pretty well. Since it's freebsd, you even don't need to worry about putting a lock around the accept() call. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message