From owner-freebsd-hackers Tue May 23 12:10:50 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id MAA09772 for hackers-outgoing; Tue, 23 May 1995 12:10:50 -0700 Received: from terra.stack.urc.tue.nl (terra.stack.urc.tue.nl [131.155.140.128]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id MAA09764 for ; Tue, 23 May 1995 12:10:48 -0700 Received: from zen.stack.urc.tue.nl (zen.stack.urc.tue.nl [131.155.140.130]) by terra.stack.urc.tue.nl (8.6.11) with ESMTP id VAA00523; Tue, 23 May 1995 21:10:35 +0200 Received: (sven@localhost) by zen.stack.urc.tue.nl (8.6.10/8.6.4) id VAA01036; Tue, 23 May 1995 21:10:43 +0200 From: sven@stack.urc.tue.nl (Sven Berkvens) Message-Id: <199505231910.VAA01036@zen.stack.urc.tue.nl> Subject: Re: accept(2) and listen(2) To: kuku@gilberto.physik.rwth-aachen.de Date: Tue, 23 May 1995 21:10:42 +0200 (MET DST) Cc: sven@stack.urc.tue.nl, freebsd-hackers@freefall.cdrom.com In-Reply-To: <199505231613.SAA16355@gilberto.physik.rwth-aachen.de> from "Christoph Kukulies" at May 23, 95 06:13:47 pm X-Mailer: ELM [version 2.4 PL23] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 802 Sender: hackers-owner@FreeBSD.org Precedence: bulk > > Say I make a process A which creates a socket, binds it to a port, > > and does a listen(2) on it. Then I fork the process, which creates > > Why that? You fork the process normally after accepting and close the > socket for the parent. The child inherits the socket and works with it > while the parent listens to new connections. > I know... That's the NORMAL way of doing things. But I want TWO processes that accept(2) on the same socket at the same time... Is that possible, and if so, what happens when a connection comes in? ie. who gets the connection? > > > another process B. Now I make both A and B accept(2) on the socket. > > What happens if a connection attempt is made? Does A or B get it, > > or is this random? Or does only A get it? > Sven Berkvens (sven@stack.urc.tue.nl)